I am trying to unassign a bulk of user's licenses from our Office365.
I have all of the user's UserPrincipalName on a CSV file like so:
Name
[email protected]
[email protected]
"
"
That is what I tried to do:
$csv1 = import-csv | select -expandProperty name
Set-MsolUserLicense -UserPrincipalName $csv1 -RemoveLicense "domain:STANDARDPACK"
When I had only one user on the CSV file, it works! But when I try to add more users to the exact file and in the exact same list, the command fails and give me this error:
Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the
Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.
I doubled checked and made sure the it is indeed the correct license (domain:StandartPack)
What else can I do? How can I make it work?