Forum Discussion
Assign selective license in Office 365 using Powershell - "Unable to assign this license ..."
Hi,
let's assume I want to only change the ProvisioningStatus of one ServicePlan and a
user has the following ServicePlans set ((Get-MsolUser -UserPrincipalName $user).Licenses.ServiceStatus)):
ServicePlan ProvisioningStatus
----------- ------------------
YAMMER_ENTERPRISE Success
OFFICESUBSCRIPTION Disabled
SHAREPOINTENTERPRISE Success
I want to set YAMMER_ENTERPRISE to "Disabled"
So I tried:
$licenseOptions = New-MsolLicenseOptions -AccountSkuId "companyname:ENTERPRISEPACK"
-DisabledPlans "YAMMER_ENTERPRISE"
Set-MsolUserLicense -UserPrincipalName $user -LicenseOptions $licenseOptions
What this does is set YAMMER_ENTERPRISE to "disabled", as expected. However, OFFICESUBSCRIPTION will now be enabled. I know this is because any ServicePlan not specified for -DisabledPlans will be enabled.
Is there an option to have every ServicePlan remain unchanged but desired one (here YAMMER_ENTERPRISE)?
I'm asking because if I wanted to automate this for a whole tenant it'd be devastating if all ServicePlans not specified for -DisabledPlans got enabled beacuse many times different users have different combinations of ServicePlans enabled/disabled and the should remain unchanged.
Thanks for your help in advance.
The cmdlets overwrite the service settings, they do not add/remove services. So when you setup the $licenseoptions variable, set both Yammer and Office to disabled. This script shows how you can do this in bulk for all users, respecting their enabled/disabled services.
- DeletedOct 24, 2017
Thanks. So do you agree that there's no convenient way to selectively enable/disable certain services so that we can treat users that have different combinations of services in bulk?
I imagine if one were to do some more elaborate scripting it might be possible. Unfortunately, this is out of my ability.
- Ian MoranOct 24, 2017Iron Contributor
Remember that license assignment can now be handled by Azure AD Groups - much more convenient
- VasilMichevOct 24, 2017MVP
The script I linked to is convenient enough for me :) It might take some adjustments to better fit your needs, but it's definitely possible to bulk edit licenses with it, while respecting the individual service status.