Forum Discussion
Jesper Stein
Sep 01, 2017Brass Contributor
Removing owner from all OneDrives....
I need some help to a powershell script, that can remove an owner on all users OneDrive. The user is added trough a 3rd party tool named ShareGate (I think by mistake) by the Sharepoint admin, so no...
- Sep 01, 2017
You can refer the this blog and it will be helpful for you
Manidurai Mohanamariappan
Sep 01, 2017Iron Contributor
You can refer the this blog and it will be helpful for you
- NCRescueTechApr 05, 2019Copper ContributorI know this thread is old, but it is the closest I have seen to my problem.
I may be wrong, but I think this answer only applies to the "Secondary Admin" permission. I have the problem where an outside partner is listed as an "Owner" on all personal sites/files. His name is not listed in the admin center under the "Secondary Owner". I inherited this mess, so I can't say how he got there.
For giggles, I have tried to run the referenced script on a test site. No luck.- Manidurai MohanamariappanApr 06, 2019Iron Contributor
I have rechecked the script is working fine and you need global administrator privilege to run this script. Try the below script to remove the secondary admin privilege and before run the script change the SecondaryAdmin ,AdminURL values
Function Remove-OnedriveSecondaryAdmin($AdminURL,$SecondaryAdmin)
{
#connect Spo service.
Connect-SPOService -Url $AdminURL
#Get all Onedrive URL's.
$OneDriveURLs = Get-SPOSite -IncludePersonalSite $true -Limit All -Filter "Url -like '-my.sharepoint.com/personal/'"
foreach($OneDriveURL in $OneDriveURLs)
{
#Add Secondary administrator to Onedrive Site.
Set-SPOUser -Site $OneDriveURL.URL -LoginName $SecondaryAdmin -IsSiteCollectionAdmin $false -ErrorAction SilentlyContinue
Write-Host "Added secondary admin to the site $($OneDriveURL.URL)"
}
}
Remove-OnedriveSecondaryAdmin -SecondaryAdmin "Admin@contoso.onmicrosoft.com" -AdminURL "https://Contoso-admin.sharepoint.com"- Sumit2475Feb 27, 2020Copper Contributor
- Jesper SteinSep 04, 2017Brass Contributor
Thanks for your inputs. We were lucky that Sharegate had a setting to roll back this setting so the problem is solved.
- Willem VerwijsMar 08, 2019Copper Contributor
Hi Jesper, what where the exact steps in ShareGate?