As of now, OneDrive for business (ODFB) get provisioned Just In time, but our requirement is to get that pre-provisioned. Follow the below steps to pre-provision ODFB for specific accounts.
Steps
A PowerShell command-let for SharePoint is available to do this, but before executing this command-let verify the following:
1. Does the user exists in SharePoint tenant and it’s active
2. Verify whether a valid 0365 license is associated to the user.
Once verified, follow the below Steps
1. Install SharePoint management shell.
http://www.microsoft.com/en-in/download/details.aspx?id=35588
2. Execute command
Connect-sposervice
Url: https://domain-admin.SharePoint.com
Enter GA credential
$emails = "user1@contoso.com,user2@contoso.com"
Request-SPOPersonalSite -UserEmails $emails
Limitations
This command-let will not show a success/failure error message
Will take a maximum of 30 min to provision an ODFB.
We can provision ODFB for 200 users in one go (but nothing more)
Verification
Please execute the script, to verify whether ODFB provisioning.
#Specify tenant admin
$User = ""
$Log = "c:Log.csv"
$Users = Get-Content D:Users.txt
#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.dll"
Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.UserProfiles.dll"
$Password = Read-Host -Prompt "Please enter your password" -AsSecureString
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
#Configure MySite Host URL
$SiteURL = "https://tenant-my.sharepoint.com"
#Bind to Site Collection
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Context.Credentials = $Creds
#Create People Manager object to retrieve profile data
$PeopleManager = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($Context)
Foreach ($User in $Users)
{
$UserProfile = $PeopleManager.GetPropertiesFor("i:0#.f|membership|" + $User.Split(" ")[2])
$Context.Load($UserProfile)
$Context.ExecuteQuery()
($User.Split(" ")[2]) + "," + $UserProfile.UserProfileProperties.'SPS-PersonalSiteCapabilities' | Out-File -Encoding Default -FilePath $Log -Append
If ($UserProfile.UserProfileProperties.'SPS-PersonalSiteCapabilities' -eq "0")
{
Write-Host "i:0#.f|membership|" - ($User.Split(" ")[2]) -ForegroundColor Red
}
}
Leave a comment