How To Pre-Provision OneDrive For Business For Users In SharePoint Online

Sriram Varadarajan
Enterprise Architect
Published On :   16 Apr 2016
Visit Count
Today :  1    Total :   9192
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

Sharegate: Kick-Ass Tool
Think Your SharePoint & Office 365 Are Secure ? Find Out Now!

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.


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.

2. Execute command

 Enter GA credential
 $emails = ","
 Request-SPOPersonalSite -UserEmails $emails


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)


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 Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
 Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
 Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.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 = ""
 #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])
     ($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
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.

Protect Your SharePoint