Remove Site Collection Administrator in SharePoint using PowerShell

Site collection administrators are administrators of the site collection with full control to the entire site collection including top-level site and all of its subsites, lists and libraries in the site collection.

How to Remove Site Collection Administrator in SharePoint?

To remove SharePoint Site Collection Administrator, we use the “Site collection Administrators” link from site settings.

remove site collection administrator

You must be a Farm Administrator or site collection administrator to see this link, BTW! From this page, we can delete site collection administrators.

remove site collection administrator powershell

PowerShell to Remove Site Collection Administrator:

We may have to remove site collection administrators programmatically. Let’s use PowerShell in SharePoint to remove site collection administrator:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

Function Remove-SiteCollAdmin($AdminID, $SiteCollectionURL)
{
    #Get the site collection
    $site = Get-SPSite $SiteCollectionURL

    #Get the Admin to remove from Site collection Administrator Group
    $Account = $site.RootWeb.SiteAdministrators | where {$_.UserLogin -eq $AdminID}
 
    #if User account found
    if($Account)
    {
        $Account.IsSiteAdmin = $false
        $Account.Update()
        Write-Host "$($AdminID) has been removed from Site Collection Administrator Group!"
    }
    else
    {
        Write-Host "$($AdminID) Not found in Site Collection Administrator Group!"
    }
}

#Call the function to remove Site collection Admin
Remove-SiteCollAdmin "Domain\UserAccount" "https://sharepoint.crescent.com/"

Note that, You can’t leave site collection Administrators empty! Usually, primary/secondary site collection administrators are assigned through the SharePoint Central Administration site. If you want to change a Primary/Secondary Site collection administrator using Central Administration/PowerShell/Stsadm tool, refer to my post: How to Change Site Collection Primary, Secondary Administrators in SharePoint?

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. Required fields are marked *