By default when user browses the OneDrive or click on OneDrive icon it’s automatically provisioned. In some cases you want pre-provision the OneDrive before the user brows. below reasons support the pre-provision requirement

  • Your organization follows the custom process to add new users and you want to provision a OneDrive when a you add a new user.
  • You are planning to migrate from On-Prem SharePoint to Microsoft 365
  • You are planning to migrate from other Online storage to OneDrive

The user accounts that you are planning to pre-provisioning must be allow to sign in and must also have a SharePoint license assigned. You must be Global or SharePoint administrator and have license assigned to pre-provision the OneDrive by using cmdlet

If you are pre-provisioning OneDrive for a large number of users , it might take multiple days for the OneDrive site to be created.

Pre-provision OneDrive for users:

  1. If you are planning to create OneDrive for many users then create a list and save file as txt.

2. Downland the latest SharePoint management Shell

3. Connect to SharePoint Online as a global admin or SharePoint admin

Connect-SPOService -Url -credential

The PowerShell command Request-SPOPersonalSite works only for users who are allowed to sign in. If you have blocked user from sign in then you can allow user to sign in by running command Set-MsolUser using text file created in step 1.

Get-Content -path "C:\Users.txt" | ForEach-Object { Set-MsolUser -UserPrincipalName $_ -BlockCredential $False }

4. Now use text file created in step 1 to provision the OneDrive

	$users = Get-Content -path "C:\Users.txt"
	Request-SPOPersonalSite -UserEmails $users

Pre-Provision OneDrive for all licensed users

The Following code will pre-provision OneDrive in batches of 199

$Credential = Get-Credential
Connect-MsolService -Credential $Credential
Connect-SPOService -Credential $Credential -Url

$list = @()
$i = 0

#Get licensed users
$users = Get-MsolUser -All | Where-Object { $_.islicensed -eq $true }
#total licensed users
$count = $users.count

foreach ($u in $users) {
    Write-Host "$i/$count"

    $upn = $u.userprincipalname
    $list += $upn

    if ($i -eq 199) {
        #We reached the limit
        Request-SPOPersonalSite -UserEmails $list -NoWait
        Start-Sleep -Milliseconds 655
        $list = @()
        $i = 0

if ($i -gt 0) {
    Request-SPOPersonalSite -UserEmails $list -NoWait

Source- Microsoft