Powershell pre provisioning One Drives on a M365 tenant

Brass Contributor

I'm new to PowerShell and trying to follow these instructions to pre provision OneDrives in bulk on a tenant

https://learn.microsoft.com/en-us/sharepoint/pre-provision-accounts#pre-provision-many-users-at-the-...

I connect to my tenant , create a text file with users and save to C drive then try and run the script but get these errors (see pic) any idea what I'm doing wrong? probably something really simple

12 Replies
Hello,
What format did you gave to the users file? did you save it where you are calling it? (C:\users.txt)
I called it users and it's a .txt file then saved on my c drive
yes , this is the path where I saved it "C:\users.txt"
Seems users.txt is empty or is failing to load
strange , as a test I have two users email addresses from the tenant in the file who's One Drives are not provisioned. Should it be a .csv file or should it be saved somewhere different to C drive?
After running
$users = Get-Content -path "C:\Users.txt"

call the variable running:

$users

and see if there is any output
that brings up the users on my text file . I'm not running it as an administrator either, is that anything to do with it?

@Andres Gorzelany did you mean like this? (see pic) it bought up the two users on my file

I changed the text file to a .csv and it worked. From the microsoft link in original post it seems to suggest creating a .txt file
It's worked once for one unprovisioned user and I'm doing exactly the same thing again for other un provisioned users and it doesn't work !
The other factor to why it wasn't working was that I was creating new users in the admin centre then trying to provision their One Drives immediately with PowerShell. I'm sure you have to wait for a certain period from when you create a new user to when the provision via PowerShell will work?

@Kevin Egan 

That could also affect