You don't need to do all that work anymore. In a recent update to the SharePoint Online PowerShell moduleSharePoint Online Management Shell, there is a commandlet to do this for you with much less effort.
It is Request-SPOPersonalSite
. You can enqueue up to 200 OneDrive for Business sites at a time.
$emails = "[email protected],[email protected]"
Request-SPOPersonalSite -UserEmails $emails
If you are going to do batches of 200 at a time, it is recommended to use the -NoWait
switch.
Request-SPOPersonalSite -UserEmails $emails -NoWait