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