Article Summary:
This article explains how you can remove the Global admin from the list of Site Collection Administrators
Instructions:
- Open your SharePoint site.
- Select Site contents.
3. Select Site settings.
4. Select Site collection administrators.
5. Here you can remove users from the list of Site Collection Administrators by selecting the x icon to the right of the user.
Or you can run a powershell script
"You will need to be a SharePoint or Global Administrator to run this script"
Import-Module Microsoft.Online.Sharepoint.PowerShell -DisableNameChecking
#Variables for processing
$AdminURL = "https://crescent-admin.sharepoint.com/"
$AdminAccount="salaudeen@crescent.com"
#Connect to SharePoint Online
Connect-SPOService -url $AdminURL -credential (Get-Credential)
#Get All Site Collections
$Sites = Get-SPOSite -Limit ALL
#Loop through each site and remove site collection admin
Foreach ($Site in $Sites)
{
Write-host "Scanning site:"$Site.Url -f Yellow
#Get All Site Collection Administrators
$Admins = Get-SPOUser -Site $site.Url | Where {$_.IsSiteAdmin -eq $true}
#Iterate through each admin
Foreach($Admin in $Admins)
{
#Check if the Admin Name matches
If($Admin.LoginName -eq $AdminAccount)
{
#Remove Site collection Administrator
Write-host "Removing Site Collection Admin from:"$Site.URL -f Green
Set-SPOUser -site $Site -LoginName $AdminAccount -IsSiteCollectionAdmin $False
}
}
}
Comments
0 comments
Please sign in to leave a comment.