I am trying to license users who already have a license assigned. For example, I have students who have been assigned Office 365 A1 for students and Office 365 ProPlus for students. In these, students are assigned only Yammer, Office Online for Education and SharePoint Plan 1 for EDU. I need to also assign Exchange Online (Plan 1) as well to the existing students. However when I run the following script, I get the error: Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.
$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"
}
My understanding is because the user is already assigned for a license so therefore they cannot be assigned another one.
Is there a way to assign a plan (Exchange Online (Plan 1)) when a user already has a license?
I have over 10k users that I need to assign this plan/license to.
Thank you for your help :)