When working with our clients, we often find that they have enabled only some of the services within an Office 365 license. Some companies, for example, may enable E3 licenses for a subset of users, but they don’t enable Lync Online. While it’s very easy to add a service from within the Office 365 Admin Center, this method is not very efficient when a company has to modify several hundred or thousands of accounts and instead want to leverage Windows PowerShell.
By combining the use of the New-MsolLicenseOptions and Set-MsolUserLicense cmdlets, it’s possible to remove and add services. In the following example, the account has been assigned all E3 services except for Office 365 ProPlus (OFFICESUBSCRIPTION) and Lync Online (Plan 2) (MCOSTANDARD):
The company wants to add the Office 365 ProPlus service, but keep the Lync Online service disabled. Running the following cmdlet will set the disabled service to only “MCOSTANDARD”:
$LicenseOptions = New-MsolLicenseOptions -AccountSkuId "company:ENTERPRISEPACK" -DisabledPlans MCOSTANDARD
Running this next cmdlet will change the license settings:
Get-MsolUser -UserPrincipalName email@example.com | Set-MsolUserLicense -LicenseOptions $LicenseOptions
Since the “OFFICESUBSCRIPTION” service was not explicitly excluded in the “DisabledPlans” parameter, by default, it will now be enabled:
Note that the “ProvisioningStatus” for OFFICESUBSCRIPTION changed from “Disabled” to “PendingInput”. When viewing the license settings in the Admin Center, the service will now be enabled under the E3 license details:
Now, again consider the scenario where a company has assigned E3 licenses, but left the Office 365 ProPlus and Lync Online (Plan 2) services disabled for all E3 licensed users. The company now wants to enable all services, and not exclude any services. In the past, Microsoft support has always provided that the only way to accomplish this is to remove the license, then reassign it without any “LicenseOptions”, effectively enabling all services. While this method is perfectly safe, some companies are a bit apprehensive to make this change to a large number of accounts at once, for fear of disconnecting the users’ mailboxes and causing a service outage.
Instead of removing and re-adding the license, it’s possible to accomplish the same task by setting the “DisabledPlans” parameter to “$Null” within the “New-MsolLicenseOptions” cmdlet. Example:
$LicenseOptions = New-MsolLicenseOptions -AccountSkuId "company:ENTERPRISEPACK" -DisabledPlans $Null Get-MsolUser -UserPrincipalName firstname.lastname@example.org | Set-MsolUserLicense -LicenseOptions $LicenseOptions
Note that both the OFFICESUBSCRIPTION and the MCOSTANDARD “ProvisioningStatus” have changed to “PendingInput”, and the services will show as enabled under the E3 license details in the Admin Center:
I hope you find this tip useful when managing your Office 365 licenses with Windows PowerShell.