Disable Office 365 License Plans with Powershell

While we set a new license to an user, we can enable or disable only a particular set of service plans of the new license. we can use the powershell cmdlet New-MsolLicenseOptions to set license plans or features that we want to disable (or remove) from new license and we have to pass this disabled license options to Set-MsolUserLicense cmdlet with the parameter -LicenseOptions.

Note: Before proceed, Install and Configure Azure AD PowerShell

Disable office 365 service plans while adding new license

To add a new license or disable service plans, we need to use AccountSkuId for the particular license, you can list all the available licenses and its AccountSkuId by running the following command.

Get-MsolAccountSku | Select AccountSkuId,SkuPartNumber,ActiveUnits,ConsumedUnits

You can get the list of all the available service plans in a particular license by using below command:

Get-MsolAccountSku | Where-Object {$_.AccountSkuId -eq 'mts:O365_BUSINESS_PREMIUM'} | ForEach-Object {$_.ServiceStatus}

#1 Create a new license options that we want to disable from the license that we are going to set to an user.

$options = New-MsolLicenseOptions -AccountSkuId mts:O365_BUSINESS_PREMIUM -DisabledPlans OFFICE_BUSINESS,MCOSTANDARD

#2 Now, we can add new license by passing new license’s AccountSkuId to Set-MsolUserLicense cmdlet and set the license options in the paramater -LicenseOptions.

Set-MsolUserLicense -UserPrincipalName '[email protected]' –AddLicenses mts:O365_BUSINESS_PREMIUM -LicenseOptions $options

Enable or Disable License Plans in existing License

Instead of disabling license plans while adding new license, you might also come across the need of enable or disable service plans in existing license. You can achieve this need by using the same office 365 powershell cmdlets Set-MsolUserLicense and New-MsolLicenseOptions. You can do it by just ignoring the parameter –AddLicenses in Set-MsolUserLicense cmdlet.

#1 Create the new license options that we want to disable from the existing license applied for the user.

$options = New-MsolLicenseOptions -AccountSkuId mts:O365_BUSINESS_PREMIUM -DisabledPlans OFFICE_BUSINESS,MCOSTANDARD

Note: There is no options like -EnabledPlans, you have use the same paramater -DisabledPlans to enable service plans in existing license by disabling other license plans

#2 Now, we can set this new license options in the Set-MsolUserLicense cmdlet with the paramater -LicenseOptions.

Set-MsolUserLicense -UserPrincipalName '[email protected]' -LicenseOptions $options
Advertisement

Leave a Comment