Thank you,
AI gave this option. But I'm not sure if it would work, if it's acceptable and secure:
(using a script to remove all non-inherited licenses)
# Get the user
$user = $Context.BindToObject($Context.TargetObject.AdsPath)
**# Get all assigned licenses
$licenses = $user.GetLicenses()
foreach ($license in $licenses) {
# Check if the license is inherited from a group
if ($license.AssignedInGroup -eq $null) {
# License is NOT inherited (directly assigned), remove it
$user.RemoveLicense($license.SkuId)
}
}**
You are correct, this is during user disablement. We know inherited licenses will be removed as they are group assigned, we want to remove "all" non inherited licenses, but the list is not know in advance. Simply to not get an error during the processing.
tx
Andras