Avatar of Anthony K O365
Anthony K O365
Flag 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?
Microsoft 365Powershell

Avatar of undefined
Last Comment
Anthony K O365

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Vasil Michev (MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Anthony K O365

ASKER
Excellent! Thank you.
Your help has saved me hundreds of hours of internet surfing.
fblack61