Skip to content

Instantly share code, notes, and snippets.

@Kumarn26
Kumarn26 / MSOL-BulkRemoveDirectAssignedLicense.ps1
Created May 31, 2023 15:13 — forked from mrik23/MSOL-BulkRemoveDirectAssignedLicense.ps1
Remove in bulk direct assigned license to users who have group assigned license with Azure AD PowerShell v1
<#
Modified version of the script from Microsoft Documentation.
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 Azure AD (aks MSOL) PowerShell v1. It doesn't seem possible to do so with v2.
Ref: https://docs.microsoft.com/en-us/azure/active-directory/active-directory-licensing-ps-examples
#>
Import-Module MSOnline
$UserCredential = Get-Credential