Note: The e-mail address of the global admin should be enclosed in double quotes (").
Removing global admin access to particular OneDrive for Business sites.
To remove the global admin’s access from particular OneDrive for Business sites, you’ll need the URL of those OneDrive for Business sites. To get the URL,
$OneDriveURL = "CopiedURL"
Replace CopiedURL with the URL of the OneDrive for Business site.
Note: The URL of the OneDrive for Business site should be enclosed in double quotes (").
{Set-SPOUser -Site $OneDriveURL -LoginName $Username -IsSiteCollectionAdmin $false -ErrorAction SilentlyContinue
To remove the global admin’s access to all sites, enter the following command.
$OneDriveURLs = Get-SPOSite -IncludePersonalSite $true -Limit All -Filter "Url -like '-my.sharepoint.com/personal/'" foreach($OneDriveURL in $OneDriveURLs) { Set-SPOUser -Site $OneDriveURL.URL -LoginName $Username -IsSiteCollectionAdmin $false -ErrorAction SilentlyContinue }
The global admin’s access to all OneDrive for Business sites will be revoked once the process is complete.