Forum Discussion
Himanshu Singh
Jun 29, 2018Iron Contributor
Office 365 Removal of Directly Assigned Licenses
At this link Microsoft shares an possibility as in a PowerShell to manage or rather remove directly assigned license to users provided you have added the users who have specific license directly assi...
Himanshu Singh
Jun 29, 2018Iron Contributor
could you please share the details on this scenario with examples
say i there are 100 users with multiple license packs out which i have assigned them the same license via group also now i need remove the directly assigned license now could you list the steps with exact commands i have to run one by one ......
and the same can be used to build a license report showing all the license packs assigned directly or being inherited via group also showing the various application enabled under each license pack
BR,
/HS
Joakim2500
Apr 17, 2020Copper Contributor
Group assigned licenses can not be removed with the powershell command.
So you can run something like a foreach loop with this commandlet and you will only remove the specifyed license from a collection of users. Remember to supress errors.
$license = 'contoso:DESKLESSPACK' # F3 licenses
Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -RemoveLicenses $license -ErrorAction SilentlyContinue
So you can run something like a foreach loop with this commandlet and you will only remove the specifyed license from a collection of users. Remember to supress errors.
$license = 'contoso:DESKLESSPACK' # F3 licenses
Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -RemoveLicenses $license -ErrorAction SilentlyContinue