Powershell through all your sites

This script specifically gets site collection admins, but it can be modified to get other data you might be interested in…

$rootSite = New-Object Microsoft.SharePoint.SPSite($siteUrl)
$spWebApp = $rootSite.WebApplication
foreach($site in $spWebApp.Sites)
{
    foreach($siteAdmin in $site.RootWeb.SiteAdministrators)
    {
        Write-Host "$($siteAdmin.ParentWeb.Url) - $($siteAdmin.DisplayName)"
    }
    $site.Dispose()
}
$rootSite.Dispose()
found it here.. http://geekswithblogs.net/bjackett/archive/2011/03/25/powershell-script-to-display-all-sharepoint-site-collection-administrators-in.aspx

Leave a comment