OneDrive Made Easy: Your Ultimate Setup & Usage Guide!
August 9, 2023By default, OneDrive accounts are set up automatically for users upon their initial visit. However, there might be situations where you’d prefer these OneDrive spaces to be set up in advance. Some reasons include:
- Setting up OneDrive accounts for new staff members as you induct them.
- Transitioning from in-house servers to Microsoft 365.
- Shifting from another cloud storage provider. For administrators aiming to set up OneDrive accounts in advance for their team, this is your go-to guide! Here’s a step-by-step walkthrough to pre-configure those OneDrive accounts:
- Draft a list of all users you wish to set up on OneDrive, saving this as a document. For instance, you might have a text document named ‘users.txt’ with the entries:
user1@mydomain.com
user2@mydomain.com
user3@mydomain.com - Fetch the most recent version of the SharePoint Online Management Shell and MSOnline.
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Install-Module -Name MSOnline
- As a global admin or SharePoint admin within Microsoft 365, establish a connection to SharePoint.
- Execute the subsequent PowerShell command, referencing the text file from the first step:
$users = Get-Content -path "C:Users.txt" Request-SPOPersonalSite -UserEmails $users
Setting up OneDrive for all licensed users in your organization
The following code snippet will pre-provision OneDrive in batches of 199. Change "contoso" to you SharePont URL. To use SPOService you need to use an app password for it to work as it doesn't support MFA. SO use a app password for the first password prompt "$Credential = Get-Credential"
$Credential = Get-Credential Connect-MsolService -Credential $Credential Connect-SPOService -Credential $Credential -Url https://contoso-admin.sharepoint.com $list = @() #Counters $i = 0 #Get licensed users $users = Get-MsolUser -All | Where-Object { $_.islicensed -eq $true } #total licensed users $count = $users.count foreach ($u in $users) { $i++ Write-Host "$i/$count" $upn = $u.userprincipalname $list += $upn if ($i -eq 199) { #We reached the limit Request-SPOPersonalSite -UserEmails $list -NoWait Start-Sleep -Milliseconds 655 $list = @() $i = 0 } } if ($i -gt 0) { Request-SPOPersonalSite -UserEmails $list -NoWait }