我試圖許可已分配許可證的用戶。例如,我有學生爲學生分配了Office 365 A1,爲學生分配了Office 365 ProPlus。其中,學生僅被分配Yammer,Office Online for Education和SharePoint計劃1供EDU使用。我還需要將Exchange Online(計劃1)也分配給現有的學生。但是,當我運行以下腳本時,出現錯誤: Set-MsolUserLicense:無法分配此許可證,因爲它是無效的。使用Get-MsolAccountSku cmdlet可以檢索有效許可證的列表。O365 - Powershell計劃許可
$Username = "[email protected]"
$Password = ConvertTo-SecureString "SomePassword" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential $Username,
$Password
Connect-MsolService -Credential $cred
$StudentUsers = Get-Content -Path "pathfile\users.txt"
Foreach ($user in $StudentUsers){
$LogPath = "logpath\$user.log"
$AccountSkuIdStandard = 「CORRECT_SUBSCRIBTION"
$ExchangeOnlineSku = New-MsolLicenseOptions -AccountSkuId
$AccountSkuIdStandard -DisabledPlans AAD_BASIC_EDU, SCHOOL_DATA_SYNC_P1,
STREAM_O365_E3, TEAMS1,Deskless, FLOW_O365_P2, POWERAPPS_O365_P2,
RMS_S_ENTERPRISE, OFFICE_FORMS_PLAN_2,PROJECTWORKMANAGEMENT,SWAY,MCOSTANDARD
#Applies standard license disabling plans
Set-MsolUserLicense -UserPrincipalName $user -AddLicenses
$AccountSkuIdStandard -LicenseOptions $ExchangeOnlineSku
Add-Content -Path $LogPath "$timestamp Attempting to license $user for O365
Exchange Online for Students"
Write-Output "Pausing script...."
Start-Sleep 3
Add-Content -Path $LogPath "$user has been licensed for O365 Exchange Online
for Students"
}
我的理解是因爲用戶已經被分配了許可證,因此他們不能被分配另一個。
當用戶已有許可證時,是否有辦法分配計劃(Exchange Online(計劃1))? 我有超過10k用戶,我需要分配此計劃/許可證。
謝謝您的幫助:)
如果您嘗試通過Web管理界面手動新的SKU分配給一個學生,會發生什麼? –