forked from jameswh3/MW-Toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNew-OneDriveSites.ps1
More file actions
35 lines (31 loc) · 1.05 KB
/
Copy pathNew-OneDriveSites.ps1
File metadata and controls
35 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#Requires -Modules Microsoft.Online.SharePoint.PowerShell
Import-Module Microsoft.Online.SharePoint.PowerShell -UseWindowsPowerShell
function New-OneDriveSites {
param (
[string[]]$usernames,
$batchsize=200,
$tenantname='yourtenantnamehere'
)
BEGIN {
$SPOAdminUrl="https://$tenantname-admin.sharepoint.com"
Connect-SPOService -Url $SPOAdminUrl
$batches = New-Object 'System.Collections.Generic.List[psobject]'
for ($i=0; $i -lt $usernames.count; $i += $batchsize) {
$batches += ,@($usernames[$i..($i+($batchsize-1))]);
}
}
PROCESS {
$usernames.count
$batchnum=1
foreach ($batch in $batches) {
$emails=$batch -join ","
$emails
"Processing batch number $batchnum"
#Request-SPOPersonalSite -UserEmails $batch -NoWait -
$batchnum++
}
}
END {
}
}
New-OneDriveSites -usernames 'user1@example.com','user2@example.com','user3@example.com' -tenantname '<your tenant name>'