Link to home
Create AccountLog in
Avatar of Anthony K O365
Anthony K O365Flag for United States of America

asked on

Office 365 - Removing assigned License from Shared mailboxes using CSV

I am trying to remove Licenses from Shared Mailboxes using the following script:

$AccountSkuId = "Tenant:STANDARDWOFFPACK_IW_FACULTY"

$Users = Import-Csv "C:\mailbox.csv"

$Users | %{

 Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName  -RemoveLicenses $AccountSkuId

}

I get the following 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 absolutely know that the sku is correct.  I also closed and re-ran the PS session connecting to Exchange Online.  Any thoughts?
ASKER CERTIFIED SOLUTION
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Anthony K O365

ASKER

Excellent! Thank you.