Saturday, February 27, 2016

Get Site Collection Administrators of All SharePoint Sites using PowerShell

Requirement: 
Get all Site collection Administrators of a SharePoint 2016 site collection.

Solution:
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.
Get Site Collection Administrators of All SharePoint Sites using PowerShell
How to Get Site Collection Administrators using PowerShell
Same thing can be done using PowerShell too.
$Site = Get-SPSite "http://intranet.crescent.com"
$Site.RootWeb.SiteAdministrators | Select DisplayName, Email
This gets you the list of site collection administrators using PowerShell!
Important: You need to be either an Site collection administrator or Farm Administrator, in order to access Site collection Administrator link. Otherwise, You won't get that link under site settings page!

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       
    }
} 
 
Or the One Liner in List format: Get site collection administrators using PowerShell
Get-SPSite | % {$_.RootWeb.SiteAdministrators} | select @{name='Url';expr={$_.RootWeb.Url}}, DisplayName, Email 



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...