Get Site Collection Administrators of All SharePoint Sites using PowerShell
Requirement: Get all Site collection Administrators of a SharePoint 2016 site collection.
Site Collection Administrators in SharePoint
SharePoint site collection administrators possess full control of the entire site collection – including top-level site, subsites, and all lists and libraries in the site collection. SharePoint 2016 site collection Administrators as assigned at site collection created by farm administrators through SharePoint Central Administration site as primary and secondary site collection owners. Additional site collection administrators can be added/removed through the site collection settings page.
Site collection administrators have the same access rights as the primary or secondary site owners assigned through the SharePoint Central Administration site, other than Notifications! Primary and secondary site collection administrators are those who’ll be getting email notifications such as Site collection storage limit warning Emails.
How to Get Primary and Secondary site collection administrators in SharePoint?
To get the primary and secondary site collection administrators, follow these steps:
- Login to SharePoint Central Administration >> Navigate to Application Management
- Click on “Change site collection administrators” under Site Collections.
- In the Change Site Collection Administrators page, You can get the primary site collection administrator and secondary site collection Administrator.
How to get site collection administrators in SharePoint?
To get a list of site collection administrators, follow these steps:
- Navigate to the site collection in interest
- Click on Site Setting gear >> choose Site Settings Menu Item
- Under Site settings page, click on “Site Collection Administrator” link in “Users and Permissions” group.
- Here you’ll find all site collection administrators.
How to Get Site Collection Administrators using PowerShell?
The same thing can be done using PowerShell too.
$Site = Get-SPSite "https://intranet.crescent.com"
$Site.RootWeb.SiteAdministrators | Select DisplayName, Email
This gets you the list of site collection administrators using PowerShell!
PowerShell to Get Site Collection Administrators for All Sites:
How about retrieving site collection administrator data for all site collections in your SharePoint environment?
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get All Site Collections
$SitesColl = Get-SPSite -Limit All
Foreach($Site in $SitesColl)
{
Write-host $Site.URL
Foreach ($SiteAdmin in $Site.RootWeb.SiteAdministrators)
{
Write-host "`t$($SiteAdmin.DisplayName) - "$SiteAdmin.Email
}
}
One Liner in List format: Get site collection administrators using PowerShell
Get-SPSite | % {$_.RootWeb.SiteAdministrators} | select @{name='Url';expr={$_.RootWeb.Url}}, DisplayName, Email
Here is my another PowerShell for SharePoint Online to get site collection administrators: SharePoint Online: PowerShell to Get All Site Collection Administrators
url is not coming
Make sure you have site collection admin rights or web app policy with “Full Control” created!