Forum Discussion
Eric Adler
Apr 25, 2017Steel 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...
Steve Hollingshead
Sep 10, 2019Copper Contributor
You can use this script I wrote to get a list of every OneDrive account and then remove the offending user:
Edit - not sure why it is throwing HTML tags into the code, remove those - you get the point.
###Script written by thestephenh@yahoo.com
###Change Tenant name below
Connect-SPOService -url "<a href="https://TENANT-admin.sharepoint.com/" target="_blank">https://TENANT-admin.sharepoint.com/</a>"
###Export a CSV with every URL of every onedrive site - Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'" | select Url | export-csv -Path c:\test\sites.csv
#type the person you want to remove on the following line
$SecondaryAdmin ="REMOVETHISUSER@CONTOSO.COM"
$users = Import-Csv -Path "C:\test\sites.csv"
foreach ($user in $users){
$site= $user.'Url'
Set-SPOUser -Site $site -LoginName $SecondaryAdmin -IsSiteCollectionAdmin $false
write-host "OneDrive Access for $SecondaryAdmin removed for $site"
}
- Fliying_eagleJun 23, 2022Copper Contributor
- SteveW_UCCSFeb 24, 2020Copper Contributor
Steve Hollingshead Thank you for this. I did something similar, $sites = get-sposite -limit All, but it did not remove the admin from all OneDrives. -Steve
- JHerschelSep 11, 2019Iron Contributor
Steve Hollingshead SaschaBuehler
You can fix this with ShareGate:
- BrianBarbagalloJan 10, 2020Brass ContributorThis is a new feature in ShareGate and wasn't around when this post was created. Nice to see this as an option. Looking at that link, that page was just updated today! 1/10/2020.