|
|
首先管理员运行powershell
执行:
Install-Module -Name AzureAD
Install-Module -Name MSOnline
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
然后登录账号:
Connect-AzureAD
Connect-MsolService
然后获取sku
Get-MsolAccountSku
复制SKU
修改下面的脚本为你的内容
生成的帐号格式为用户名前缀+第几个
例如ppx1..ppx2..ppx1000
注意修改if的 1 5000
-
- Function GetRandom($NUM,$RT){
- If ([String]::IsNullOrEmpty($NUM)) { Return } Else { If ([String]::IsNullOrEmpty($($($NUM).ToString()).Trim())){ Return }}
- If ($NUM -match ",") {$Len1 = (($NUM -split(",", 2))[0]).Trim(); $Len2 = (($NUM -split(",",2))[1]).Trim()} Else{$Len = $NUM; $Len1 ="";$Len2 =""}
- If (-Not ([String]::IsNullOrEmpty($Len1) -or [String]::IsNulorEmpty($Len2))) { $Len = ((([convert]::ToInt32($Len1,10)).. ([convert]::ToInt32($Len2,10)))| Get-Random) }
- If ([String]::IsNullOrEmpty($Len)) { Return }
- $RList = (49..57 + 65..90 + 97..122)
- Return -join( $RList | Get-Random -count $Len| %{[char]$_})
- }
- for($i=1;$i -le 5000;$i++)
- { $passwd=GetRandom(16)
- $passwd=$passwd+"!"
- #$head=GetRandom(8)
- $name="用户名前缀"+$i+"@你的域名"
- New-MsolUser -DisplayName O365 -UserPrincipalName $name -UsageLocation US -Password $passwd -LicenseAssignment xxxxx:STANDARDWOFFPACK_STUDENT
- "$name--$passwd" | Out-File -Append D:\A1P_STU.txt
- }
复制代码 |
|