Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre-provision-accounts.md #4224

Open
wants to merge 1 commit into
base: public
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions SharePoint/SharePointOnline/pre-provision-accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,21 @@ To verify that OneDrive has been created for your users, see [Get a list of all

## Pre-provision OneDrive for all licensed users in your organization

The following code snippet will pre-provision OneDrive in batches of 199.
The following code snippet will pre-provision all licensed users OneDrive in batches of 199.


```PowerShell
$Credential = Get-Credential
Connect-MgGraph -Credential $Credential
Connect-SPOService -Credential $Credential -Url https://contoso-admin.sharepoint.com
## Connecting to Graph and SharePoint using the MFA connection method.
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All"
Connect-SPOService -Url https://contoso-admin.sharepoint.com/

$list = @()
#Counters
$i = 0
$j = 0

#Get licensed users
$users = Get-MgUser -All | Where-Object { $_.islicensed -eq $true }
$users = Get-MgUser -Filter 'assignedLicenses/$count ne 0' -ConsistencyLevel eventual -CountVariable unlicensedUserCount -All;
#total licensed users
$count = $users.count

Expand Down
Loading