Add Site Collection Administrator to All Sites in SharePoint using PowerShell

Site collection administrators have God-like power within a Site Collection in SharePoint 2016. Apart from Primary and Secondary site collection administrators, we can add additional site collection administrators on any SharePoint site collection. When managing SharePoint sites, it is often necessary to add or remove site collection administrators. This can be a time-consuming process if you need to do it for each site individually. This blog post will show you how to use PowerShell to add a site collection administrator to all sites in your SharePoint environment.

How to Add a Site Collection Administrator in SharePoint 2016?

To add a Site Collection Administrator, follow these steps:

  • Site Settings Gear >> Click on “Site Settings” Menu Item
  • Click on the “Site collection administrators” link under “Users and Permissions”
  • Enter the New user in Site Collection Administrators Field. Click OK to save your changes.
    PowerShell to Add Site Collection Administrator to All Sites in SharePoint

OK! Now, How about adding the same user as an administrator in all site collections?

PowerShell Script to Add a Site Collection Administrator to All Site Collections in SharePoint:

If you manage multiple SharePoint sites, it can be helpful to add a site collection administrator to all of them. This can be done quickly and easily with PowerShell.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#User Account to add as Site Collection Admin
$UserAccount="Crescent\Salaudeen"

Get-SPSite -Limit "All" | ForEach-Object { 
$User = $_.RootWeb.EnsureUser($UserAccount)
    if($User.IsSiteAdmin -ne $True)
    {
        $User.IsSiteAdmin = $True
        $User.Update()
        Write-Host "Added Site Collection Administrator for Site Collection:" $_.URL -ForegroundColor Green
    }
    else
    {
        Write-Host "User is already an Site Collection Administrator for Site Collection:" $_.URL -ForegroundColor Yellow
    }
} 
You can use Web Application User Policy in Central Admin to give Full control to the Entire web application, instead of adding users into individual site collections!

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

Your email address will not be published.