SharePoint Pals
 | Sign In
How To Pre-Provision OneDrive For Business For Users In SharePoint Online
by Sriram Varadarajan 16 Apr 2016
Enterprise Architect
Today  :   5     Total  :    2718

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
blog comments powered by Disqus

SharePoint Pals

SharePoint Pals, a community portal for SharePoint developers, Administrators and End Users. Let's join hands and share the point together.
Read this on mobile


Angular Js Training In Chennai
Advanced Angular Js training with real world developer scenarios
Angular Js, Web Api and Ionic for .Net Developers
All in one client side application development for .Net developers
Angular Js For SharePoint Developers
Get ready for the future. Its no more just C#

Get Connected

SharePoint Resources

SharePoint 2013 and 2010 Web Parts
Free Web Parts with Source Code for SharePoint Community

SharePoint 2013 Books and Tutorials
Collection of free SharePoint 2013 books and tutorials (eBooks, pdfs)

Supported By

Contribute your article and be eligible for a one month Free Subscription for Plural Sight. The Author of the most popular New Article (published in the previous month) will be awarded with a Free One month Plural Sight Subscription. Article can be sent to in a word document.

Related Resources

Recent Tweets

Twitter October 21, 21:34
How to Add a JS Link Reference to the Display Form or Any other ASPX Programmatically using CSOM PNP in SharePoint -

Twitter October 20, 13:01
How to Add a JS Link Reference to the NewForm and EditForm Programmatically using CSOM PNP in SharePoint Office 365-

Twitter October 12, 12:15
How to Deploy Provider Hosted Apps (Add-Ins) by App Stapling in SharePoint Office 365 -

Twitter October 11, 13:39
How to Deploy Provider HostedApp programmatically using CSOM in SharePoint Office 365 Activating Developer Feature -

Twitter October 10, 09:26
How to Use Angular HTTP Services in SharePoint List -

Follow us @SharePointPals
Note: For Customization and Configuration, CheckOutRecent Tweets Documentation