Error with User-Drive Mapping and SharePoint
When creating a User Drive Mapping job with Office 365/SharePoint 2013/One Drive for Business as the destination, you may receive the following message: "This instance does not support OneDrive (or MySite) detection."
This may be caused if One Drive for Business is not provisioned/installed, the source folder name cannot be mapped to a valid One Drive for Business library, or if the user has never accessed their One Drive and it has not been setup yet by the system.
Components Required:
To run the script, you will need the following components installed:
AdministrationConfig_2 (Windows Azure Active Directory Module for Windows PowerShell Setup)
msoidcli_64 (The Microsoft Online Services Sign-In Assistant)
The Script:
The following Powershell Script will prompt for the user to log in, retrieves all the admins and inserts them into a collection.
$objCreds = Get-Credential
$siteAdminUrl = "https://skysyncdesktop-admin.sharepoint.com"
$sitePersonalBaseUrl = "https://skysyncdesktop-my.sharepoint.com/personal/"
$sitePersonalSuffix = "_skysyncdesktop_onmicrosoft_com"
Connect-SPOService -Url $siteAdminUrl -credential $objCreds
Connect-MSOLService -credential $objCreds
$objRole = Get-MsolRole -RoleName "Company Administrator"
$colAdmins = Get-MsolRoleMember -RoleObjectId $objRole.ObjectId | Select EmailAddress
$colUsers = Get-MSOLUser -All | Select UserPrincipalName
Write-Host "Users"
foreach ($objUser in $colUsers){
$strUser = $objUser.userprincipalname
$intPos = $strUser.IndexOf("@")
$strUser = $strUser.SubString(0, $intPos)
$strUser = $strUser.replace(".","_")
$strSite = $sitePersonalBaseUrl + $strUser
$strSite = $strSite + $sitePersonalSuffix
foreach ($objAdmin in $colAdmins){
Write-Host $objAdmin.EmailAddress
Write-Host $strSite
Set-SPOUser -Site $strSite -LoginName $objAdmin.EmailAddress -IsSiteCollectionAdmin $true
}
}
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")