Friday, 22 May 2015

Generate report of all SharePoint groups along with their owner information in a SharePoint FARM using PowerShell


#-----------------------------------------------------------------------
# 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!!"

No comments:

Post a Comment