While trying to bulk remove licensing for some users in my tenant, I keep receiving the same results when removing the license. My script is below, referenced from this page:
PS Connect-MsolService (provide username and password here)
PS Get-MsolAccountSku | ft AccountSkuId
AccountSkuId
------------
*****:STANDARDWOFFPACK
PS $AccountSkuId="****:STANDARDWOFFPACK"
PS $UsageLocation="US"
PS $Users=Import-Csv '\pathToMyCSV.csv'
PS $Users | ForEach-Object {
Set-MsolUser -UserPrincipalName $_.UserPrincipalName -UsageLocation $UsageLocation
Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses $AccountSkuId
}
When I run these commands the output is the following for each user in my CSV:
Set-MsolUserLicense
: Unable to assign this license because it is invalid. Use the
Get-MsolAccountSku cmdlet to retrieve a list of valid...