Forum Discussion
Rohitban
Nov 22, 2022Copper Contributor
Remove allocated O365 licenses for specified user using PS Script
I am getting error while running below PS commands after successful authentication.
$Licenses = Get-MgUserLicenseDetail -UserId $Name
Get-MgUserLicenseDetail -UserId $Name | foreach {Set-MgUserLicense -UserId $Name -AddLicenses @() -RemoveLicenses @($Licenses.SkuId)}
Note : $Name is provided as argument.
- And what's the error that you receive?
Any update ?