If you need take ownership of an employees OneDrive, run the following PowerShell code.
Some requirements before running the script.
- Azure Active Directory PowerShell Module: https://msdn.microsoft.com/en-us/library/azure/jj151815(v=azure.98).aspx
- SharePoint Online Management Shell: https://www.microsoft.com/en-us/download/details.aspx?id=35588
1 2 3 4 5 6 7 8 9 |
Connect-MsolService -Credential (Get-Credential); $NewOwner = "myuser@contoso.com"; $SharePointAdministrationURL = "https://contoso.sharepoint.com" $OneDriveURL = "https://contoso.sharepoint.com/personal/myuser_contoso_com"; Connect-SPOService -Url "$SharePointAdministrationURL"; $Site = Get-SPOSite -Identity "$OneDriveURL" Set-SPOUser -Site $Site.Url -LoginName "$NewOwner" -IsSiteCollectionAdmin $true |
In the “$OneDriveURL” replace “myuser_contoso_com” content with your “$NewOwner“, but instead of dots (“.“) use underscores (“_“).