In Microsoft 365, OneDrive sites are not created until users access them for the first time. This behavior can cause delays during SharePoint Server migrations when immediate access to cloud storage is required. To avoid such interruptions, admins can pre-provision OneDrive sites in advance so that users have instant access, content transfers can start right away, and the entire migration process remains smooth and uninterrupted.
Connect to the SharePoint Online Management Shell and execute the below cmdlet to pre-provision a OneDrive site for a Microsoft 365 user.
Request-SPOPersonalSite -UserEmails "<UserUPN>"
When onboarding a large number of users, pre-provisioning OneDrive sites one user at a time can be time-consuming. In such scenarios, you can provision OneDrive sites for multiple users at once.
- Create a text file (e.g., Users.txt) with the email addresses of all users for whom you want to pre-provision OneDrive sites, as shown in the image below.
- Run the following PowerShell cmdlet to pre-provision OneDrive sites for all listed users.
$users = Get-Content -Path "C:\Users.txt"
Request-SPOPersonalSite -UserEmails $users
When you want to provision OneDrive sites for all users, manually identifying those who don't have a site and provisioning them isn't practical in a large organization. To overcome this, you can pre-provision OneDrive sites for all licensed users in your organization at once to save time and effort.
Run the below cmdlet to pre-provision OneDrive for all licensed users in your organization.
Connect-MgGraph -Scopes "User.Read.All"
Connect-SPOService -Url "https://<TenantName>-admin.sharepoint.com"
$activeUsers = Get-MgUser -All -ConsistencyLevel eventual -CountVariable userCount -Filter "accountEnabled eq true" -Property AssignedLicenses,DisplayName,UserPrincipalName,Mail
$licensedUsers = $activeUsers | Where-Object { $_.AssignedLicenses.Count -gt 0 }
$list = @()
foreach ($u in $licensedUsers) {
$list += $u.UserPrincipalName
if ($list.Count -eq 199) {
Request-SPOPersonalSite -UserEmails $list -NoWait
$list = @()
}
}
if ($list.Count -gt 0) {
Request-SPOPersonalSite -UserEmails $list -NoWait
}
Note: The above snippet provisions OneDrive sites in batches of 199 users, as the 'Request-SPOPersonalSite' cmdlet can process up to 200 users at a time.