Skip to content

Instantly share code, notes, and snippets.

View neil-sabol's full-sized avatar

Neil Sabol neil-sabol

  • New Mexico, USA
View GitHub Profile
@neil-sabol
neil-sabol / MgGraph-BulkRemoveDirectAssignedLicense.ps1
Last active February 1, 2024 10:47 — forked from mrik23/MSOL-BulkRemoveDirectAssignedLicense.ps1
Remove in bulk direct assigned license to users who have group assigned license with the Microsoft Graph (MgGraph) PowerShell module
<#
Modified version of mrik23's MSOL-BulkRemoveDirectAssignedLicense.ps1 (https://gist.github.com/mrik23/2ed37ce0c7c4a79605bdcf052e29b391)
MSOL-BulkRemoveDirectAssignedLicense.ps1 was a modified version of a script from Microsoft Documentation.
Ref: https://docs.microsoft.com/en-us/azure/active-directory/active-directory-licensing-ps-examples
Removed the part that checks if the users is assigned more products than the group assigned license.
Added connection part and help to find Sku and Group Object ID.
This script requires the Microsoft Graph (MgGraph) PowerShell module.
#>
Import-Module Microsoft.Graph.Users