Forum Discussion
Office 365 Removal of Directly Assigned Licenses
The cmdlets you have to use is the same in all cases:
Set-MsolUserLicense -ObjectId $user.ObjectId -RemoveLicenses $skuId
The script in that article simply check whether there are more than one SKU assigned to that user, and if so skips the user. You can run the cmdlet manually or amend the script to account for the scenario where more than one SKU is assigned.
- Himanshu SinghJun 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
- Joakim2500Apr 17, 2020Copper ContributorGroup 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