Another one in the series of “did you know that…”. If you have ever used PowerShell to assign licenses to a user, you might be aware of the method to disable particular service, say assign the E3 plan with Exchange Online disabled. In a nutshell, one has to use the following two cmdlets:
PS C:\> $l1 = New-MsolLicenseOptions -AccountSkuId tenant:ENTERPRISEPACK -DisabledPlans EXCHANGE_S_ENTERPRISE
to set the customized plan, followed by
PS C:\> Set-MsolUserLicense -UserPrincipalName firstname.lastname@example.org -AddLicenses tenant:ENTERPRISEPACK -LicenseOptions $l1
to actually assign the license.
Now, what if you wanted to assign multiple licenses? The -AddLicenses parameter accepts multi-string values, so one can do the following:
PS C:\> Set-MsolUserLicense -UserPrincipalName email@example.com -AddLicenses tenant:PLANNERSTANDALONE,tenant:ENTERPRISEPACK -LicenseOptions $l1
So we just assigned both the E3 and the Planner standalone licenses, while disabling the Exchange online service at the same time. As the customized plan settings, contained in the $l1 variable, include the information of the license/SKU we are customizing, no conflict will occur. And we can even take it one step further – prepare yet another customized plan (in this case the Planner SKU, with the Planner service disabled), and use the same one-liner to assign both plans. Here’s how it would look like:
PS C:\> $l2 = New-MsolLicenseOptions -AccountSkuId tenant:PLANNERSTANDALONE -DisabledPlans PROJECTWORKMANAGEMENT
to create the second customized plan, followed by
PS C:\> Set-MsolUserLicense -UserPrincipalName firstname.lastname@example.org -AddLicenses tenant:PLANNERSTANDALONE,tenant:ENTERPRISEPACK -LicenseOptions $l1,$l2
to assign both SKUs with their respective customized options. The end result:
PS C:\> (Get-MsolUser -UserPrincipalName email@example.com).licenses.servicestatus ServicePlan ProvisioningStatus ----------- ------------------ PROJECTWORKMANAGEMENT Success SWAY Success INTUNE_O365 PendingActivation YAMMER_ENTERPRISE Success RMS_S_ENTERPRISE Success OFFICESUBSCRIPTION Success MCOSTANDARD Success SHAREPOINTWAC PendingInput SHAREPOINTENTERPRISE PendingInput EXCHANGE_S_ENTERPRISE Disabled PROJECTWORKMANAGEMENT Disabled
where the second instance of the PROJECTWORKMANAGEMENT service is the one we disabled via the $l2 plan settings.
That’s all for today’s tip, hopefully you will find it useful, or just interesting 🙂
3 thoughts on “Assigning multiple customized SKUs to an Office 365 user via PowerShell”
Great article. I was trying to figure out this from a couple of days. Thank you…
Could you please tell me how to assign multiple license accountsku to a single user and to multiple users via csv?