Share via


Office 365: How to batch initialize OneDrive for Business

More and more customers need to migrate Office 365 objects (Mailbox, OneDrive for business and SharePoint Online) from current tenant to another new tenant according to the internal Business requirements.

Before tenant to tenant migration, Office 365 administrator need to add or syncs users in the new subscription at first , then batch initialize OneDrive for Business instead of manually logging in accounts one by one and then completing the initialization process by clicking "OneDrive for Business", there are two specific processes:

 

  • Use the PowerShell command to batch initialize OneDrive for Business
  • Use the PowerShell command to verify that OneDrive has been created for your users

 

Steps for using the PowerShell command to batch initialize OneDrive for Business:

 

  1. Install 'Windows Azure Active Directory Module for Windows PowerShell' and then import MSOnline using Global Administrator 

Import-Module MSOnline

$msolCred = Get-Credential

2. Connect to SharePoint Online Service as a global admin or SharePoint admin in Office 365:

Connect-MsolService -credential $msolCred

Connect-SPOService -url https://mvptraining-admin.sharepoint.com -Credential $msolCred

3.This example requests that two users to be enqueued for the creation of a Personal Site:

$emails = "junzheliu0415@mvptraining.onmicrosoft.com","neilding0705@mvptraining.onmicrosoft.com"

 4.Run the PowerShell command:request-SPOPersonalSite -UserEmails $emails -nowait

[

](resources/66623.4.png)Notes:

  1. -nowait Continues without the status being polled. Polling the action can slow it’s progress if lots of user emails are specified.
  2. Request-SPOPersonalSite cmdlet requests that the users specified be enqueued so that a Personal Site be created for each. The actual Personal Site is created by a Timer Job later.
  3. The command will stop if it encounters any empty strings in the array. A maximum of 200 users can be specified.
  4. The actor executing this cmdlet must be at least assigned the SharePoint Online administrator role and have been assigned a SharePoint Online license to be able to provision the OneDrive for Business sites. The users who the sites will be provisioned for must also have a SharePoint license assigned

To verify that OneDrive has been created for your users:

1. Get-SPOSite -Template "SPSPERS" -limit ALL -includepersonalsite $True | Select URL, Owner | Format-table -autosize | Out-string -width 8096 | Out-file C:\OneDriveSites.txt

2. After the command successfully completes, a text file is created in the location specified . This file contains a list of all OneDrive Urls in your organization. The following text provides an example of how the list of Urls in this file should be formatted.

 

Hopefully it can help you manage your OneDrive.