3

I want to have a powershell based tool to have report of all SharePoint groups along with their owners (I mean site collection admins).

I am new to powershell, any help is appreciated.

1
  • Please clarify - Owner - administrator of site or of group Commented Jun 10, 2016 at 14:24

2 Answers 2

2

you can try below code: It will export to csv/excel format for you.

#-----------------------------------------------------------------------
# Location can be changed as per need
#-----------------------------------------------------------------------
$location = "GetAllOwnerReport.csv"


$Information = ""
$rptData = "Web Name, Group Name , Owner Name"

$webApps = Get-SPWebapplication

foreach($webApp in $webApps)
{
 $sites = $webApp.sites

 foreach($site in $sites)
 {
  $webs = $site.AllWebs

  foreach($web in $webs)
  {     
    foreach($group in $web.groups)
    {      
      $Information = $web.Url + " , " + $group.Name + " , " + $group.owner;            
      $rptData += "`r`n" + $entry
    }
    $web.Dispose()
  }
  $site.Dispose()
 }
}

$rptData | Out-File "$location" 
write-host "Competed!!"
2
  • Thank you Farshid, It was throwing error at code: $rptData += "rn" + $entry, somehow fixed it.
    – user51831
    Commented Jun 10, 2016 at 14:33
  • Does this need any SharePoint Powershell modules installed? Or does it have to be run from SharePoint online management shell?
    – golimar
    Commented Feb 14, 2020 at 9:56
2

This will provide all groups in the provided site url

Get-SPSite http://server/sites/yoursite |
                            Select -ExpandProperty RootWeb |
                            Select -ExpandProperty Groups |
                            Select {$_.ParentWeb.Url}, Name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.