This script displays all Site collection Administrators along with their email addresses for all web applications.
Get-SPSite | % {$_.RootWeb.SiteAdministrators} | select @{name='Url';expr={$_.ParentWeb.Url}}, LoginName, Email
If you are on WSS v.3/MOSS 2007 use the next defenition for Get-SPSite
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | Out-Null
function Get-SPSite{
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$farm.services | % {if($_.WebApplications.Count){$_.WebApplications}} | % {if($_.sites.Count){$_.sites}}
}
Thanks so much! That worked perfectly. But I want to add the Site Title to the outcome as well. Which is actually ROOTWEB. Can this be done or does it need to be a separate command?
I appreciate your quick response.
Yes it can be done:) Could not test right now. Use one of these scripts.
Get-SPSite | % {$_.RootWeb.SiteAdministrators} | select @{name=’Url’;expr={$_.ParentWeb.Url}}, @{name=’Title’;expr={$_.ParentWeb.Title}}, LoginName, Email
or
Get-SPSite | % {$_.RootWeb.SiteAdministrators} | select @{name=’Url’;expr={$_.ParentWeb.Url}}, @{name=’Title’;expr={$_.ParentWeb.Name}}, LoginName, Email