SOLVED

O365 Licensing Add Additional Service Plans via PowerShell

Contributor

I am receiving the below error when running the below PowerShell command. I think this issue is because the user already has an E3 license with some service plans enabled. How do I enable additional service plans for a user who already has an E3 license and service plans enabled?

 

Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.

 

Connect-MsolService

$Users = Import-csv "C:\Users\username\Desktop\userlist.csv"
$AccountSkuId = "tenant:ENTERPRISEPACK"

$ServicePlans = Get-MsolAccountSku | Where {$_.SkuPartNumber -eq "ENTERPRISEPACK"}

### Setting up the license option to disable SharePoint etc ###,
$LicenseOptions = New-MsolLicenseOptions -AccountSkuId "tenant:ENTERPRISEPACK" -DisabledPlans "KAIZALA_O365_P3","MICROSOFT_SEARCH","WHITEBOARD_PLAN2","MIP_S_CLP1","MYANALYTICS_P2","BPOS_S_TODO_2","FORMS_PLAN_E3","Deskless","FLOW_O365_P2","POWERAPPS_O365_P2","PROJECTWORKMANAGEMENT","SWAY","INTUNE_O365","YAMMER_ENTERPRISE","RMS_S_ENTERPRISE","SHAREPOINTWAC"



$Users | ForEach-Object {

Set-msoluser -UserPrincipalName $_.UserPrincipalName
Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses $AccountSkuId -LicenseOptions $LicenseOptions

}

2 Replies
best response confirmed by blue_man (Contributor)
Solution

actually would simply changing the foreach command to the below work?

 

https://docs.microsoft.com/en-us/office365/enterprise/powershell/disable-access-to-services-with-off...

 

$Users | ForEach-Object {

Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -LicenseOptions $LicenseOptions

}