Ensure that you have the proper licenses in place for the user
Param(
[Parameter(Mandatory = $False)]
[String]$SharepointURL = "https://COMPANYINC-admin.sharepoint.com/",
[Parameter(Mandatory = $False)]
[String]$tenantID = "TENANTID",
[Parameter(Mandatory = $True)]
[String]$UserEmail = ""
)
# Connect to services
Connect-MgGraph -TenantId $tenantID -Scopes 'User.Read.All'
Connect-SPOService -Url $SharepointURL
Write-Host "Checking if user $UserEmail exists..."
try {
$u = Get-MgUser -UserId $UserEmail -Select UserPrincipalName, AssignedLicenses
if ($u) {
Write-Host "User found. Requesting OneDrive provisioning for $($u.UserPrincipalName)..."
Request-SPOPersonalSite -UserEmails @($u.UserPrincipalName) -NoWait
Write-Host "Provisioning request submitted successfully."
Write-Host "Note: OneDrive creation is asynchronous and may take time."
}
}
catch {
Write-Error "Could not find user $UserEmail or unable to query Microsoft Graph."
}
Disconnect-SPOService
Disconnect-MgGraphOpen up a powershell window as Admin and go to the directory you have saved your script
.\singleconvert.ps1You will be prompted to login with a user that has privileges to work in the 365 tenant.
You will get a subsequent prompt (likely) to enter in your credentials for a user that has 365 admin privileges
Check your tenant again. In my experience, if the script is run, and assuming the rest of your licenses are good, it only took a few minutes for the status to change in 365
