I had an issue where Microsoft had issued a TS license pack key that had way too many licenses in it versus what was actually purchased through the CSP portal and I needed to remove some additional per user RDS licenses.
I had mixed results when trying to remove, and a lot of the information on the web I found was mainly for device CALS and not the user ones i needed to remove.
In the end I found a way to remove RDS CALS on Server 2016 (this will work on other server os’ too)
This command below displays the licensing info:
PS C:\Windows\system32> Get-WmiObject Win32_TSLicenseKeyPack|Select KeyPackId, ProductVersion, TotalLicenses, TypeAndModel|Format-List

KeyPackId : 2
ProductVersion : Windows 2000 Server
TotalLicenses : 4294967295
TypeAndModel : Built-in TS Per Device CAL
KeyPackId : 3
ProductVersion : Windows Server 2016
TotalLicenses : 5
TypeAndModel : RDS Per User CAL
KeyPackId : 4
ProductVersion : Windows Server 2016
TotalLicenses : 500
TypeAndModel : RDS Per User CAL
This command below is what actually removes 495 licenses from keypack 4 ID
Invoke-WmiMethod -Class Win32_TSLicenseKeyPack -Name RemoveLicensesWithIdCount -ArgumentList 4,495
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 0
PSComputerName :
Re-run the command to check and confirm the licenses have been removed from the targetted keypack ID.
Get-WmiObject Win32_TSLicenseKeyPack|Select KeyPackId, ProductVersion, TotalLicenses, TypeAndModel|Format-List
KeyPackId : 2
ProductVersion : Windows 2000 Server
TotalLicenses : 4294967295
TypeAndModel : Built-in TS Per Device CAL
KeyPackId : 3
ProductVersion : Windows Server 2016
TotalLicenses : 5
TypeAndModel : RDS Per User CAL
KeyPackId : 4
ProductVersion : Windows Server 2016
TotalLicenses : 5
TypeAndModel : RDS Per User CAL