Swap Office 365 Licences

Swap Office 365 Licences

Update

The process detailed below has been deprecated by Microsoft. An updated version of this process is detailed in my post called Swap Microsoft 365 Licenses with Microsoft Graph.

I needed to remove some expired Office 365 licences that were expired to the point where I couldn’t do it via the admin interface so I wrote a PowerShell script to automate swapping the Office 365 licences.

You will want to run Get-MsolAccountSku this will list out the various SKUs your account has. something like this

tenant:VISIOCLIENT
tenant:PROJECTCLIENT
tenant:EXCHANGESTANDARD
tenant:O365_BUSINESS_PREMIUM
tenant:OFFICESUBSCRIPTION
tenant:PROJECTPROFESSIONAL

Just change the values in the script below to match what product you want to remove and replace it with and then run it.

$remove = "tenant:EXCHANGESTANDARD"
$add = "tenant:O365_BUSINESS_PREMIUM"

$swap = get-MSOLUser -All | where {$_.isLicensed -eq "TRUE" -and $_.Licenses.AccountSKUID -eq "$remove"}

Foreach ($User in $swap) {
Set-MsolUserLicense -UserPrincipalName $User.UserPrincipalName -RemoveLicenses "$remove" -AddLicenses $add
}
Code language: PowerShell (powershell)

That is basically it. It will just run and swap the licences.

Exit mobile version