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 - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *