Forum Discussion
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 assigned to a Group and this Group has been assigned the same license as the command / script requires group ID or object ID for the group to be specified in the script
https://docs.microsoft.com/en-us/azure/active-directory/active-directory-licensing-ps-examples
However the issue this only works if your users dont have any other license packs assigned,
If your users have another license packs assigned it skips the removal of direct license assignment with similar or following message
User has extra plans that may be lost - license removal was skipped. Extra plans: BI_AZURE_P2
Is there a way this can be achieved even when there are other license packs assigned to the user
BR,
/HS
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 SinghIron 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
- Joakim2500Copper 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