Quantcast
Channel: Microsoft Office 365
Viewing all articles
Browse latest Browse all 17713

Remove Bulk Office 365 Licenses

$
0
0

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...


Viewing all articles
Browse latest Browse all 17713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>