Global Admin Showing up with Access to All Users OneDrive for Business

%3CLINGO-SUB%20id%3D%22lingo-sub-64823%22%20slang%3D%22en-US%22%3EGlobal%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-64823%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20seeing%20one%20of%20the%20global%20admin%20accounts%20(mine)%20as%20having%20accesss%20to%20ever%20users%20OneDrive%20account.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhile%20in%20OneDrive%20it%20says%20it%20Shared%20%22Only%20You%22%20when%20you%20click%20on%20it%20you%20see%20that%20two%20accounts%20have%20access.%20My%20user%20account%20and%20one%20of%20the%20global%20admin%20accounts%20(which%20happens%20to%20be%20mine%20as%20well).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhy%20is%20this%3F%20How%20can%20I%20remove%20this%3F%3F%3F%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%2C%3C%2FP%3E%3CP%3EeZe%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-64823%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOneDrive%20for%20Business%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-393263%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-393263%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F70747%22%20target%3D%22_blank%22%3E%40Joshua%20Mohr%3C%2FA%3E%26nbsp%3BIf%20you%20are%20ever%20in%20need%20to%20gain%20that%20access%20back%20or%20set%20another%20person%20to%20the%20OneDrive%2C%20say%20after%20a%20person%20leaves%20the%20company%2C%20you%20can%20grant%20permissions%20using%20this%20script.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%24MySite%3C%2FSPAN%3E%3CSPAN%3E%3D%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2FYOURSITE-my.sharepoint.com%2Fpersonal%2FYOURUSER_YOURSITE_com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2FYOURSITE-my.sharepoint.com%2Fpersonal%2FYOURUSER_YOURSITE_com%2F%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%24SecondaryAdmin%20%3C%2FSPAN%3E%3CSPAN%3E%3D%3C%2FSPAN%3E%3CSPAN%3E%22You%40YOURSITE.com%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ESet%3C%2FSPAN%3E%3CSPAN%3E-SPOUser%20-Site%20%3C%2FSPAN%3E%3CSPAN%3E%24MySite%20%3C%2FSPAN%3E%3CSPAN%3E-LoginName%20%3C%2FSPAN%3E%3CSPAN%3E%24%3C%2FSPAN%3E%3CSPAN%3ESecondaryAdmin%20%3C%2FSPAN%3E%3CSPAN%3E-IsSiteCollectionAdmin%20%3C%2FSPAN%3E%3CSPAN%3E%24true%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-382579%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-382579%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64710%22%20target%3D%22_blank%22%3E%40Brian%20Barbagallo1%3C%2FA%3E%26nbsp%3BThanks%20for%20sharing%20this%20script!%20Had%20to%20do%20some%20minor%20changes%20for%20get%20it%20working%20but%20helped%20me%20a%20lot.%20Had%20the%20same%20issue%20because%20of%20sharegate.%20Now%20everything%20is%20like%20it%20should%20be%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-219374%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-219374%22%20slang%3D%22en-US%22%3E%3CP%3EI%20just%20found%20your%20post%20while%20researching%20on%20this%20as%20I%20realized%20I%20am%20secondary%20admin%20to%2012k%20user%20profiles%20in%20our%20company!%20Credit%20to%20Microsoft%20support%20on%20this%20PowerShell%20below.%20Running%20the%20following%20script%20will%20remove%20you%20from%20the%20secondary%20admin%20to%20all%20the%20my.sharepoint.com%20sites%2C%20and%20it%20can%20be%20ran%20as%20SharePoint%20admin%20as%20well%20so%20Global%20admin%20isn't%20necessary%20to%20successfully%20run%20this.%20You%20would%20need%20to%20go%20back%20into%20the%20user%20profiles%20in%20the%20SharePoint%20admin%20center%20to%20add%20yourself%20back%20if%20needed%2C%20or%20rerun%20the%20script%20below%20and%20set%20the%20secondary%20admin%20name%2C%20and%20change%20the%20%24false%20to%20%24true%20on%20this%20line%20from%20in%20the%20script.%3C%2FP%3E%3CP%3E%24temp%20%3D%20Set-SPOUser%20-Site%20%24sitename%20-LoginName%20%24secondaryadmin%20-IsSiteCollectionAdmin%20%24false%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERun%20as%20administrator%20the%20SharePoint%20Online%20Management%20Shell%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%23%20Run%20the%20below%20script%20(copy%20and%20paste%20into%20the%20shell%20window).%3C%2FP%3E%3CP%3EConnect-sposervice%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2FYOURSITE-admin.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2FYOURSITE-admin.sharepoint.com%3C%2FA%3E%3C%2FP%3E%3CP%3E%23%20Specify%20your%20organization%20admin%20central%20url%3C%2FP%3E%3CP%3E%24AdminURI%20%3D%20%22%3CA%20href%3D%22https%3A%2F%2FYOURSITE-admin.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2FYOURSITE-admin.sharepoint.com%3C%2FA%3E%22%3C%2FP%3E%3CP%3E%23%20Specify%20the%20User%20account%20for%20an%20Office%20365%20global%20admin%20in%20your%20organization%3C%2FP%3E%3CP%3E%24AdminAccount%20%3D%20WHOAREYOU%40YOURSITE.COM%3C%2FP%3E%3CP%3E%24AdminPass%20%3D%3C%2FP%3E%3CP%3E%23%20Specify%20the%20secondary%20admin%20account%20and%20the%20url%20for%20the%20onedrive%20site%3C%2FP%3E%3CP%3E%24secondaryadmin%20%3D%20%22WHOAREYOU%40YOURSITE.COM%22%3C%2FP%3E%3CP%3E%24siteURI%20%3D%20%22%3CA%20href%3D%22https%3A%2F%2FYOURSITE-my.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2FYOURSITE-my.sharepoint.com%3C%2FA%3E%20%22%3C%2FP%3E%3CP%3E%24loadInfo1%20%3D%20%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SharePoint.Client%22)%3C%2FP%3E%3CP%3E%24loadInfo2%20%3D%20%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SharePoint.Client.Runtime%22)%3C%2FP%3E%3CP%3E%24loadInfo3%20%3D%20%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SharePoint.Client.UserProfiles%22)%3C%2FP%3E%3CP%3E%24sstr%20%3D%20ConvertTo-SecureString%20-string%20%24AdminPass%20-AsPlainText%20-Force%3C%2FP%3E%3CP%3E%24AdminPass%20%3D%20%22%22%3C%2FP%3E%3CP%3E%24creds%20%3D%20New-Object%20Microsoft.SharePoint.Client.SharePointOnlineCredentials(%24AdminAccount%2C%20%24sstr)%3C%2FP%3E%3CP%3E%24UserCredential%20%3D%20New-Object%20System.Management.Automation.PSCredential%20-argumentlist%20%24AdminAccount%2C%20%24sstr%3C%2FP%3E%3CP%3E%23%20Add%20the%20path%20of%20the%20User%20Profile%20Service%20to%20the%20SPO%20admin%20URL%2C%20then%20create%20a%20new%20webservice%20proxy%20to%20access%20it%3C%2FP%3E%3CP%3E%24proxyaddr%20%3D%20%22%24AdminURI%2F_vti_bin%2FUserProfileService.asmx%3Fwsdl%22%3C%2FP%3E%3CP%3E%24UserProfileService%3D%20New-WebServiceProxy%20-Uri%20%24proxyaddr%20-UseDefaultCredential%20False%3C%2FP%3E%3CP%3E%24UserProfileService.Credentials%20%3D%20%24creds%3C%2FP%3E%3CP%3E%23%20Set%20variables%20for%20authentication%20cookies%3C%2FP%3E%3CP%3E%24strAuthCookie%20%3D%20%24creds.GetAuthenticationCookie(%24AdminURI)%3C%2FP%3E%3CP%3E%24uri%20%3D%20New-Object%20System.Uri(%24AdminURI)%3C%2FP%3E%3CP%3E%24container%20%3D%20New-Object%20System.Net.CookieContainer%3C%2FP%3E%3CP%3E%24container.SetCookies(%24uri%2C%20%24strAuthCookie)%3C%2FP%3E%3CP%3E%24UserProfileService.CookieContainer%20%3D%20%24container%3C%2FP%3E%3CP%3E%23%20Sets%20the%20first%20User%20profile%2C%20at%20index%20-1%3C%2FP%3E%3CP%3E%24UserProfileResult%20%3D%20%24UserProfileService.GetUserProfileByIndex(-1)%3C%2FP%3E%3CP%3EWrite-Host%20%22Starting-%20This%20could%20take%20a%20while.%22%3C%2FP%3E%3CP%3E%24NumProfiles%20%3D%20%24UserProfileService.GetUserProfileCount()%3C%2FP%3E%3CP%3E%24i%20%3D%201%3C%2FP%3E%3CP%3EConnect-SPOService%20-Url%20%24AdminURI%20-Credential%20%24UserCredential%3C%2FP%3E%3CP%3E%23%20As%20long%20as%20the%20next%20User%20profile%20is%20NOT%20the%20one%20we%20started%20with%20(at%20-1)...%3C%2FP%3E%3CP%3EWhile%20(%24UserProfileResult.NextValue%20-ne%20-1)%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3EWrite-Host%20%22Examining%20profile%20%24i%20of%20%24NumProfiles%22%3C%2FP%3E%3CP%3E%23%20Look%20for%20the%20Personal%20Space%20object%20in%20the%20User%20Profile%20and%20retrieve%20it%3C%2FP%3E%3CP%3E%23%20(PersonalSpace%20is%20the%20name%20of%20the%20path%20to%20a%20user's%20OneDrive%20for%20Business%20site.%20Users%20who%20have%20not%20yet%20created%20a%3C%2FP%3E%3CP%3E%23%20OneDrive%20for%20Business%20site%20might%20not%20have%20this%20property%20set.)%3C%2FP%3E%3CP%3E%24Prop%20%3D%20%24UserProfileResult.UserProfile%20%7C%20Where-Object%20%7B%20%24_.Name%20-eq%20%22PersonalSpace%22%20%7D%3C%2FP%3E%3CP%3E%24Url%3D%20%24Prop.Values%5B0%5D.Value%3C%2FP%3E%3CP%3E%23%20If%20OneDrive%20is%20activated%20for%20the%20user%2C%20then%20set%20the%20secondary%20admin%3C%2FP%3E%3CP%3Eif%20(%24Url)%20%7B%3C%2FP%3E%3CP%3E%24sitename%20%3D%20%24siteURI%20%2B%20%24Url%3C%2FP%3E%3CP%3E%24temp%20%3D%20Set-SPOUser%20-Site%20%24sitename%20-LoginName%20%24secondaryadmin%20-IsSiteCollectionAdmin%20%24false%20-ErrorAction%20SilentlyContinue%3C%2FP%3E%3CP%3EWrite-Host%20%22Added%20secondary%20admin%20to%20the%20site%20%24(%24sitename)%22%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%23%20And%20now%20we%20check%20the%20next%20profile%20the%20same%20way...%3C%2FP%3E%3CP%3E%24UserProfileResult%20%3D%20%24UserProfileService.GetUserProfileByIndex(%24UserProfileResult.NextValue)%3C%2FP%3E%3CP%3E%24i%2B%2B%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-204280%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-204280%22%20slang%3D%22en-US%22%3E%3CP%3EDid%20you%20get%20an%20upgrade%20from%20ShareGate%3F%26nbsp%3B%20I%20got%20an%20upgrade%20about%20three%20months%20ago%20and%20had%20to%20revert%20back%20to%20an%20older%20version%20because%20of%20problems%20I%20was%20having.%26nbsp%3B%20Now%20when%20I%20log%20into%20ShareGate%2C%20I%20am%20asked%20to%20upgrade%2C%20but%20have%20not%20done%20that%20yet.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-204275%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-204275%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20appears%20that%20ShareGate%20added%20mine%20for%20me%20to%20all%20the%20OneDrives.%20I%20turn%20the%20setting%20off%20and%20it%20gets%20turned%20back%20on.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-195781%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-195781%22%20slang%3D%22en-US%22%3E%3CP%3EMany%20thanks%2C%20very%20much%20appreciated.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-195779%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-195779%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20-my%2Fpersonal%2FFName_LName_tenant_com%20-YourLoginName%40yourcompanyname.com%20in%20case%20that%20is%20not%20clear%20since%20the%20text%20is%20underlined%20as%20a%20url.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-195778%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-195778%22%20slang%3D%22en-US%22%3E%3CP%3ESure%2C%20I%20got%20it%20directly%20from%20Microsoft%20-%20here%20is%20the%20script%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPowershell%20command%20to%20attach%20to%20someone's%20OneDrive%20as%20a%20secondary%20Administrator%20to%20copy%20files%3A%3C%2FP%3E%3CP%3E%26nbsp%3BOpen%20SharePoint%20Online%20Management%20Shell%20-%20run%20as%20Administrator%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECopy%20and%20run%20this%20script%20below%20replacing%20the%20user's%20name%20and%20using%20underscore%20between%20user%20first%20name%20and%20last%20name%20and%20yourcompany.com%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESet-SPOUser%20-Site%20%3CA%20href%3D%22https%3A%2F%2Famtrak-my.sharepoint.com%2Fpersonal%2FFirstName_LastName_amtrak_com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%3CFONT%20color%3D%22%230066cc%22%3Ehttps%3A%2F%2Fyour-tenant-my.sharepoint.com%2Fpersonal%2FFirstName_LastName_yourcompany_com%3C%2FFONT%3E%3C%2FA%3E%20-LoginName%20Your.Name%40yourcompany.com%20-IsSiteCollectionAdmin%20%24false%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20hit%20ENTER%20to%20run.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENOTES%3A%3C%2FP%3E%3CP%3E%24true%20adds%20you%20as%20an%20Admin%20to%20their%20OneDrive%3C%2FP%3E%3CP%3E%24false%20removes%20you%20as%20Admin%20to%20their%20OneDrive%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-195734%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-195734%22%20slang%3D%22en-US%22%3ECould%20you%20please%20advise%20where%20you%20got%20the%20script%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-195731%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-195731%22%20slang%3D%22en-US%22%3E%3CP%3EI%20got%20a%20powershell%20script%20to%20remove%20my%20permissions%20from%20all%20OneDrive%20users.%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-195715%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-195715%22%20slang%3D%22en-US%22%3E%3CP%3EHaving%20serious%20issues%20with%20Share%20gate%2C%20It%20let%20me%20add%20these%20global%20permissions%20but%20not%20revoke%20them.%3CBR%20%2F%3EEric%2C%20could%20you%20perhaps%20share%20the%20script%20Microsft%20Supplied%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-188635%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-188635%22%20slang%3D%22en-US%22%3E%3CP%3EI%20removed%20the%20secondary%20owner%20in%20the%20central%20admin%20center%20but%20it%20did%20not%20remove%20it%20-%20is%20this%20something%20that%20takes%2024%20hours%20to%20perform%20this%20task%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-64929%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-64929%22%20slang%3D%22en-US%22%3E%3CP%3ESo%20it%20was%20Sharegate%20that%20%22did%22.%20I%20mean%2C%20I%20did%20it%2C%20through%20Sharegate.%20Sharegate%20also%20had%20the%20ability%20to%20undo%20it%20as%20well.%20I%20used%20a%20PowerShell%20script%20that%20MSFT%20provided%20instead%20(they%20were%20first).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20was%20interesting%20to%20troubleshoot%20with%20MSFT.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20setting%20is%20under%20the%20good%20old%20%22central%20admin%22%20now%20SharePoint%20admin.%20We%20used%20the%20user%20profile%20to%20check%20to%20see%20if%20%22My%20Site%22%20had%20a%20secondary%20admin%2C%20and%20it%20did.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFunny%20to%20see%20how%20little%20they%20have%20changed%20the%20UI.%20We%20looked%20under%26nbsp%3B%20%22Setup%20My%20Sites%22%20to%20see%20if%20there%20was%20a%20default%20secondary%20admin%26nbsp%3Bor%20secodary%20owner.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20everyone%20for%20you%20help!!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-64908%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-64908%22%20slang%3D%22en-US%22%3EI%20have%20this%20same%20problem%20some%20weeks%20ago...and%20what's%20something%20totally%20unexpected%20so%20it%20seems%20something%20is%20doing%20%22weird%22%20things%20behind%20the%20scenes.%20By%20the%20way%2C%20use%20Vasil's%20advice%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-64903%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-64903%22%20slang%3D%22en-US%22%3E%3CP%3EI%20echo%20those%20remarks%2C%20it's%20likely%20a%20script%20that%20was%20run.%20%26nbsp%3BIf%20you%20happen%20to%20use%20ShareGate%2C%20it%20will%20run%20that%20script%20for%20you.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-64851%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-64851%22%20slang%3D%22en-US%22%3E%3CP%3EThat's%20most%20likely%20the%20Secondary%20Owner%20option%20under%20SPO%20Admin%20Center%20-%26gt%3B%20User%20Profiles%20-%26gt%3B%20My%20Site%20Settings%26nbsp%3B-%26gt%3B%20Setup%20My%20Sites%20-%26gt%3B%20My%20Site%20Cleanup.%20Similarly%2C%20check%20the%20My%20Site%20Secondary%20Admin%20option%20below%20that%20one.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-64849%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-64849%22%20slang%3D%22en-US%22%3E%3CP%3ECheck%20your%20site%20collection%20admin%20settings%20on%20the%20onedrive%20sites.%20You%20probably%20at%20some%20point%20or%20someone%20ran%20a%20script%20to%20add%20your%20to%20all%20sites%20as%20a%20site%20collection%20admin.%20Your%20going%20to%20have%20to%20undo%20this%20for%20it%20to%20go%20away.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-541180%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-541180%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F155910%22%20target%3D%22_blank%22%3E%40Chip%20Denton%3C%2FA%3E%26nbsp%3Bfor%20us%2C%20ShareGate%20adds%20whoever's%20running%20a%20matrix%20report%20as%20secondary%20owner%20to%20personal%20OneDrive%20accounts%2C%20we%20spoke%20with%20ShareGate%20and%20they%20said%20it's%20because%20the%20account%20logged%20in%20and%20running%20the%20report%20needs%20access%20to%20each%20personal%20OneDrive%20site%20to%20pull%20the%20stats.%20This%20was%20late%202018%2C%20so%20I%20don't%20know%20if%20it's%20changed.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-844306%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-844306%22%20slang%3D%22en-US%22%3Ecould%20you%20share%20this%20script%2C%20please%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-847714%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-847714%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1137%22%20target%3D%22_blank%22%3E%40Eric%20Adler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20use%20this%20script%20I%20wrote%20to%20get%20a%20list%20of%20every%20OneDrive%20account%20and%20then%20remove%20the%20offending%20user%3A%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3EEdit%20-%20not%20sure%20why%20it%20is%20throwing%20HTML%20tags%20into%20the%20code%2C%20remove%20those%20-%20you%20get%20the%20point.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406004%22%20target%3D%22_blank%22%3E%40SaschaBuehler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%20class%3D%22post-author-login%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-python%22%3E%3CCODE%3E%23%23%23Script%20written%20by%20thestephenh%40yahoo.com%0A%0A%23%23%23Change%20Tenant%20name%20below%0AConnect-SPOService%20-url%20%22%3CA%20href%3D%22https%3A%2F%2FTENANT-admin.sharepoint.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2FTENANT-admin.sharepoint.com%2F%3C%2FA%3E%22%0A%23%23%23Export%20a%20CSV%20with%20every%20URL%20of%20every%20onedrive%20site%20-%20%20Get-SPOSite%20-IncludePersonalSite%20%24true%20-Limit%20all%20-Filter%20%22Url%20-like%20'-my.sharepoint.com%2Fpersonal%2F'%22%20%7C%20select%20Url%20%7C%20export-csv%20-Path%20c%3A%5Ctest%5Csites.csv%0A%0A%23type%20the%20person%20you%20want%20to%20remove%20on%20the%20following%20line%0A%24SecondaryAdmin%20%3D%22REMOVETHISUSER%40CONTOSO.COM%22%0A%24users%20%3D%20Import-Csv%20-Path%20%22C%3A%5Ctest%5Csites.csv%22%0Aforeach%20(%24user%20in%20%24users)%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24site%3D%20%24user.'Url'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Set-SPOUser%20-Site%20%24site%20-LoginName%20%24SecondaryAdmin%20-IsSiteCollectionAdmin%20%24false%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20write-host%20%22OneDrive%20Access%20for%20%24SecondaryAdmin%20removed%20for%20%24site%22%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-848687%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-848687%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F175410%22%20target%3D%22_blank%22%3E%40Steve%20Hollingshead%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406004%22%20target%3D%22_blank%22%3E%40SaschaBuehler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20fix%20this%20with%20ShareGate%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsupport-desktop.sharegate.com%2Fhc%2Fen-us%2Farticles%2F115000647528-Can-I-remove-myself-as-an-administrator-after-I-have-auto-assigned-myself-as-one-%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport-desktop.sharegate.com%2Fhc%2Fen-us%2Farticles%2F115000647528-Can-I-remove-myself-as-an-administrator-after-I-have-auto-assigned-myself-as-one-%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1063413%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1063413%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64710%22%20target%3D%22_blank%22%3E%40Brian%20Barbagallo1%3C%2FA%3E%26nbsp%3B%20we%20want%20to%20give%20rights%20to%20list%20of%20one%20drive%20accounts%20not%20all%20accounts.%20whether%20it%20is%20possible%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1102481%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1102481%22%20slang%3D%22en-US%22%3EThis%20is%20a%20new%20feature%20in%20ShareGate%20and%20wasn't%20around%20when%20this%20post%20was%20created.%20Nice%20to%20see%20this%20as%20an%20option.%20Looking%20at%20that%20link%2C%20that%20page%20was%20just%20updated%20today!%201%2F10%2F2020.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1191453%22%20slang%3D%22en-US%22%3ERe%3A%20Global%20Admin%20Showing%20up%20with%20Access%20to%20All%20Users%20OneDrive%20for%20Business%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1191453%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F175410%22%20target%3D%22_blank%22%3E%40Steve%20Hollingshead%3C%2FA%3E%26nbsp%3BThank%20you%20for%20this.%26nbsp%3B%20I%20did%20something%20similar%2C%26nbsp%3B%24sites%20%3D%20get-sposite%20-limit%20All%2C%20but%20it%20did%20not%20remove%20the%20admin%20from%20all%20OneDrives.%26nbsp%3B%20-Steve%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

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 accounts have access. My user account and one of the global admin accounts (which happens to be mine as well).

 

Why is this? How can I remove this????

 

Thank you,

eZe

24 Replies

Check your site collection admin settings on the onedrive sites. You probably at some point or someone ran a script to add your to all sites as a site collection admin. Your going to have to undo this for it to go away. 

That's most likely the Secondary Owner option under SPO Admin Center -> User Profiles -> My Site Settings -> Setup My Sites -> My Site Cleanup. Similarly, check the My Site Secondary Admin option below that one.

I echo those remarks, it's likely a script that was run.  If you happen to use ShareGate, it will run that script for you. 

I have this same problem some weeks ago...and what's something totally unexpected so it seems something is doing "weird" things behind the scenes. By the way, use Vasil's advice

So it was Sharegate that "did". I mean, I did it, through Sharegate. Sharegate also had the ability to undo it as well. I used a PowerShell script that MSFT provided instead (they were first).

 

It was interesting to troubleshoot with MSFT.

 

The setting is under the good old "central admin" now SharePoint admin. We used the user profile to check to see if "My Site" had a secondary admin, and it did.

 

Funny to see how little they have changed the UI. We looked under  "Setup My Sites" to see if there was a default secondary admin or secodary owner.

 

Thanks everyone for you help!!!

I removed the secondary owner in the central admin center but it did not remove it - is this something that takes 24 hours to perform this task?

Having serious issues with Share gate, It let me add these global permissions but not revoke them.
Eric, could you perhaps share the script Microsft Supplied?

 

Many thanks.

I got a powershell script to remove my permissions from all OneDrive users. Thanks.

Could you please advise where you got the script?

Sure, I got it directly from Microsoft - here is the script:

 

Powershell command to attach to someone's OneDrive as a secondary Administrator to copy files:

 Open SharePoint Online Management Shell - run as Administrator

 

Copy and run this script below replacing the user's name and using underscore between user first name and last name and yourcompany.com

 

Set-SPOUser -Site https://your-tenant-my.sharepoint.com/personal/FirstName_LastName_yourcompany_com -LoginName Your.Name@yourcompany.com -IsSiteCollectionAdmin $false

 

Then hit ENTER to run.

 

NOTES:

$true adds you as an Admin to their OneDrive

$false removes you as Admin to their OneDrive

 

The -my/personal/FName_LName_tenant_com -YourLoginName@yourcompanyname.com in case that is not clear since the text is underlined as a url.

Many thanks, very much appreciated. 

It appears that ShareGate added mine for me to all the OneDrives. I turn the setting off and it gets turned back on.

Did you get an upgrade from ShareGate?  I got an upgrade about three months ago and had to revert back to an older version because of problems I was having.  Now when I log into ShareGate, I am asked to upgrade, but have not done that yet.

I just found your post while researching on this as I realized I am secondary admin to 12k user profiles in our company! Credit to Microsoft support on this PowerShell below. Running the following script will remove you from the secondary admin to all the my.sharepoint.com sites, and it can be ran as SharePoint admin as well so Global admin isn't necessary to successfully run this. You would need to go back into the user profiles in the SharePoint admin center to add yourself back if needed, or rerun the script below and set the secondary admin name, and change the $false to $true on this line from in the script.

$temp = Set-SPOUser -Site $sitename -LoginName $secondaryadmin -IsSiteCollectionAdmin $false

 

Hope this helps!

 

Run as administrator the SharePoint Online Management Shell

 

# Run the below script (copy and paste into the shell window).

Connect-sposervice

https://YOURSITE-admin.sharepoint.com

# Specify your organization admin central url

$AdminURI = "https://YOURSITE-admin.sharepoint.com"

# Specify the User account for an Office 365 global admin in your organization

$AdminAccount = WHOAREYOU@YOURSITE.COM

$AdminPass =

# Specify the secondary admin account and the url for the onedrive site

$secondaryadmin = "WHOAREYOU@YOURSITE.COM"

$siteURI = "https://YOURSITE-my.sharepoint.com "

$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")

$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

$loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles")

$sstr = ConvertTo-SecureString -string $AdminPass -AsPlainText -Force

$AdminPass = ""

$creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($AdminAccount, $sstr)

$UserCredential = New-Object System.Management.Automation.PSCredential -argumentlist $AdminAccount, $sstr

# Add the path of the User Profile Service to the SPO admin URL, then create a new webservice proxy to access it

$proxyaddr = "$AdminURI/_vti_bin/UserProfileService.asmx?wsdl"

$UserProfileService= New-WebServiceProxy -Uri $proxyaddr -UseDefaultCredential False

$UserProfileService.Credentials = $creds

# Set variables for authentication cookies

$strAuthCookie = $creds.GetAuthenticationCookie($AdminURI)

$uri = New-Object System.Uri($AdminURI)

$container = New-Object System.Net.CookieContainer

$container.SetCookies($uri, $strAuthCookie)

$UserProfileService.CookieContainer = $container

# Sets the first User profile, at index -1

$UserProfileResult = $UserProfileService.GetUserProfileByIndex(-1)

Write-Host "Starting- This could take a while."

$NumProfiles = $UserProfileService.GetUserProfileCount()

$i = 1

Connect-SPOService -Url $AdminURI -Credential $UserCredential

# As long as the next User profile is NOT the one we started with (at -1)...

While ($UserProfileResult.NextValue -ne -1)

{

Write-Host "Examining profile $i of $NumProfiles"

# Look for the Personal Space object in the User Profile and retrieve it

# (PersonalSpace is the name of the path to a user's OneDrive for Business site. Users who have not yet created a

# OneDrive for Business site might not have this property set.)

$Prop = $UserProfileResult.UserProfile | Where-Object { $_.Name -eq "PersonalSpace" }

$Url= $Prop.Values[0].Value

# If OneDrive is activated for the user, then set the secondary admin

if ($Url) {

$sitename = $siteURI + $Url

$temp = Set-SPOUser -Site $sitename -LoginName $secondaryadmin -IsSiteCollectionAdmin $false -ErrorAction SilentlyContinue

Write-Host "Added secondary admin to the site $($sitename)"

}

# And now we check the next profile the same way...

$UserProfileResult = $UserProfileService.GetUserProfileByIndex($UserProfileResult.NextValue)

$i++

}

@Brian Barbagallo1 Thanks for sharing this script! Had to do some minor changes for get it working but helped me a lot. Had the same issue because of sharegate. Now everything is like it should be :)

@Joshua Mohr If you are ever in need to gain that access back or set another person to the OneDrive, say after a person leaves the company, you can grant permissions using this script.

 

$MySite="https://YOURSITE-my.sharepoint.com/personal/YOURUSER_YOURSITE_com/"

$SecondaryAdmin ="You@YOURSITE.com"

Set-SPOUser -Site $MySite -LoginName $SecondaryAdmin -IsSiteCollectionAdmin $true

@Chip Denton for us, ShareGate adds whoever's running a matrix report as secondary owner to personal OneDrive accounts, we spoke with ShareGate and they said it's because the account logged in and running the report needs access to each personal OneDrive site to pull the stats. This was late 2018, so I don't know if it's changed. 

could you share this script, please