Forum Discussion
Removing owner from all OneDrives....
- Sep 01, 2017
You can refer the this blog and it will be helpful for you
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.
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
- NCRescueTechApr 09, 2019Copper Contributor
I do have Global Admin privileges. Please clarify something that may help me. I am under the impression that there are two "Secondary" settings that can be granted, Admin and Owner. The script is using the admin, but I am looking to remove an owner.
- Manidurai MohanamariappanApr 12, 2019Iron Contributor
By default you can sent only one owner per site collection (Onedrive) so you can change the owner using below script and it will remove your old owner.
Set-SPOSite -Identity https://contoso-my.sharepoint.com/personal/user_contoso_onmicrosoft_com -Own
er admin@contoso.onmicrosoft.com