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:


$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?
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

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


Excellent! Thank you.