This blog post describes a scenario where not all users in your Microsoft 365 tenancy have OneDrive and how to provision it where required.
As a general rule I’ve found that most users who are in your M365 tenancy should have OneDrive irrespective of whether they are using it or not.
During a project I was involved with, we were compiling a list of all our M365 users home drive source locations to migrate the data into their respective OneDrive’s. Completing this exercise we found that not everyone in our organisation actually had OneDrive provisioned.
Information online as to the reasons why was scant, with much of what others describe around licensing issues not being applicable in this situation.
When you look at a user’s OneDrive information within the M365 admin center, you will see this:
I’m not 100% sure why these users are without OneDrive as the accounts checked hadn’t been blocked. However they have not had any sign in activity for the last 30 days – although we have set our retention for OneDrive to be 90 days before deleting so it’s still a bit of a mystery.
Microsoft have provided documentation on how to pre-provision OneDrive for users in your organization which is exactly what we needed. The documentation details two ways in which you can approach the problem:
- Pre-provision OneDrive for users – Create a list of users who need OneDrive > save as a txt file > run PowerShell to provision OneDrive for those users
- Pre-provision many users at the same time – Run PowerShell to provision OneDrive for large numbers of users
In this example we didn’t know how many of our users were without OneDrive so we choose to go with option 2.
How to provision OneDrive for large numbers of users
- The account you are using to run the script needs to be a global or SharePoint administrator and must be assigned a SharePoint license
- The user accounts that you are provisioning must be allowed to sign in and also have a SharePoint license assigned
- Make sure you have the latest version of the SharePoint Online Management Shell installed
Run the PowerShell script
- Open SharePoint Online Management Shell
- Run the PowerShell script
The script should loop through until it completes for all users in your tenancy. You should see it looping through like in the example screenshot below:
Issues & resolution steps
Before I start describing my experiences of running the script, I am a relative PowerShell novice so forgive my ignorance if some of this is elementary. I had some trouble getting the script to run, which I think was more to do with the cmdlets I had installed (I’ve had a new laptop recently) rather than the script.
Issues with Connect-sposervice
I had issues connecting to the SharePoint admin center, I was receiving an error like this:
I found this post on koskila.net that is really helpful and may help others with similar issues. In the end I got the script to run by removing the $credential variable at the start of the Microsoft script and connecting to the msolservice and sposervice directly.
With the $credential variable removed, I was prompted to login twice, once for msolservice, and again for sposervice, which then authenticated moved on to the next stage of the script.
One thought on “How to provision OneDrive for Microsoft 365 users”