Forum Discussion
Eric Adler
Apr 25, 2017Iron Contributor
Global Admin Showing up with Access to All Users OneDrive for Business
We are seeing one of the global admin accounts (mine) as having accesss to ever users OneDrive account. While in OneDrive it says it Shared "Only You" when you click on it you see that two accoun...
ambikad1575
Sep 25, 2024Copper Contributor
1. Connect to SharePoint Tenant.
Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential email address removed for privacy reasons
2. Get The list of OneDrive URLs of users in CSV format for whom this action needs to be performed.
Below is the command to get the OneDrive URLs of the users if you don’t have it already
Get-SPOSite -IncludePersonalSite $true -Limit all | Export-Csv D:\Onedrive.CSV
3. Run below command: This will remove user’s ownership from OneDrive
Import-Csv D:\OneDriveURL.csv | foreach {Set-SPOUser -Site $_.url -LoginName email address removed for privacy reasons -IsSiteCollectionAdmin $false}
Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential email address removed for privacy reasons
2. Get The list of OneDrive URLs of users in CSV format for whom this action needs to be performed.
Below is the command to get the OneDrive URLs of the users if you don’t have it already
Get-SPOSite -IncludePersonalSite $true -Limit all | Export-Csv D:\Onedrive.CSV
3. Run below command: This will remove user’s ownership from OneDrive
Import-Csv D:\OneDriveURL.csv | foreach {Set-SPOUser -Site $_.url -LoginName email address removed for privacy reasons -IsSiteCollectionAdmin $false}