Link to home
Start Free TrialLog in
Avatar of Ali Raza
Ali RazaFlag for United States of America

asked on

Office 365 Removing the license as a bundle

By using the below script, we remove licenses from terminated users.


It is possible to remove licenses from users without having to go to the license service, and we can remove licenses from terminated users as a bundle?


Example:

A user has a F3 license, and the next user has a M3/E3 license. We need to remove all the licenses according to the user assignment.


$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:DESKLESSPACK"}

$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:EXCHANGEARCHIVE_ADDON"}

$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:ATP_ENTERPRISE"}

$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:ENTERPRISEPACK"}

$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:SPE_E3"}

$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:POWER_BI_STANDARD"}

$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:FLOW_FREE"}

$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:PROJECTPROFESSIONAL"}

$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:POWERAPPS_VIRAL"}

$Users | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses "abc:POWER_BI_PRO"}


Avatar of FOX
FOX
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial