Display SharePoint Site collection Administrators

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

Howto: Display all SharePoint items created today

Get-SPSite | % {$_.AllWebs} | % {$_.Lists} | % {$_.Items} | ? {$_["Created"].Date -eq [System.DateTime]::ToDay} | % {"$($_.Web.Url)/$($_.Url)"}

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

Display SharePoint Site Owners for Every Site

Get-SPSite | % {$_.RootWeb.AssociatedOwnerGroup.Users} | 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}}
}