Zachary Loeber

I eat complexity and am never without a meal.

PowerShell: Office 365 Group Based Licencing Cleanup

A script to remove directly assigned licenses from user accounts if they overlap with group assigned licenses in Office 365.

If you have deployed group-based licensing in Office 365 you may be left with a bunch of accounts that have licensing assigned both directly and via your license groups. If left this way then users that leave the organization may still consume a license in Office 365. This script will remove all directly assigned licenses only if they overlap with group assigned licenses.

There is an extra bit at the end that can be used to remove any leftover directly assigned licenses as well.