How to Provision OneDrive for Microsoft 365 users through powershell.
Provision OneDrive to all users in Office 365 through PowerShell:
- Download the latest SharePoint Online Management Shell.
- Connect to SharePoint as a global admin or SharePoint admin in Microsoft 365.
- Create a text file that contains a list of all the users who you want to provision OneDrive for. The format of the text file should be one user per line, and the user’s UPN or email address should be used.
- Save the text file to a location that you can easily access.
- Open a PowerShell window and navigate to the folder where you saved the text file.
- Run the following PowerShell command:
Request-SPOPersonalSite -UserFile <path to text file>
This command will provision OneDrive for all of the users in the text file.
Here is an example of a PowerShell command that you can use:
Request-SPOPersonalSite -UserFile C:\Users\admin\Desktop\users.txt
This command will provision OneDrive for all of the users in the text file users.txt, which is located on the user’s desktop.
Once you have run the PowerShell command, it will take a few minutes for OneDrive to be provisioned for all of the users. Once it is provisioned, the users will be able to access their OneDrive sites by signing in to Office 365 and clicking on the “OneDrive” icon.
Here are some additional things to keep in mind when provisioning OneDrive for users through PowerShell:
- The users must have a valid Office 365 license in order to use OneDrive.
- The users must be allowed to sign in to Office 365 in order to access their OneDrive sites.
- If you are provisioning OneDrive for a large number of users, it may take some time for the command to complete.