Forum Discussion

FcoManigrasso's avatar
FcoManigrasso
Iron Contributor
Mar 27, 2023

Remove services from O365 license: PowerShell

Hi Community,

 

Sometimes we need to remove certain services from a license assigned to the users in M365.

There're many ways to do it, ( also the Admin Center ), but today we'll see how to list and exclude the desired services using PowerShell.

 

First of all, we need to connect to the cloud:

 

Connect-MsolService

 

And list our available licenses:

 

Get-MsolAccountSku | Select AccountSkuId | Sort AccountSkuId

 

The output should look something like this:

 

 

Then we need to list the services included in our desired license:

 

(Get-MsolAccountSku | where {$_.AccountSkuId -eq "Company:DEVELOPERPACK_E5"}).ServiceStatus

 

The output looks like this:

 

 

Finally, we only need to use the "New-MsolLicenseOptions" cmdlt in order to disable the service/s. We can run it for the license itself and apply to the whole Company or use a variable to assign that license with the disabled service to specific users:

 

$LO = New-MsolLicenseOptions -AccountSkuId "Company:DEVELOPERPACK_E5" -DisabledPlans "POWERAPPS_O365_P3"
Set-MsolUserLicense -UserPrincipalName email address removed for privacy reasons -LicenseOptions $LO

 

 

1 Reply

Resources