How to Set Up Remote Desktop Licensing on Windows Server 2019
Remote Desktop Licensing (RD Licensing) manages the Remote Desktop Services Client Access Licenses (RDS CALs) that are required for users or devices to connect to Remote Desktop Session Host servers. Every client connecting to an RD Session Host beyond the two built-in administrator sessions requires a valid RDS CAL. Windows Server 2019 supports both Per User and Per Device licensing modes, and the RD Licensing role can be installed on any Windows Server in the environment — it does not need to be on the RDSH server itself.
Understanding RDS CAL Types
There are two types of RDS CALs in Windows Server 2019. Per Device CALs are assigned to client computers or devices. Once assigned, any user logging in from that device does not consume additional licenses. Per User CALs are assigned to user accounts in Active Directory. Once assigned, the user can connect from any number of devices. Per User mode requires Active Directory and can only be enforced when the license server is domain-joined. Per Device licenses can be tracked and enforced without a domain, making them suitable for workgroup environments.
Installing the Remote Desktop Licensing Role
The RD Licensing role can be installed using Server Manager or PowerShell. It is recommended to install the licensing server on a dedicated server or your Connection Broker server rather than directly on an RD Session Host. Install the role and management tools.
# Install RD Licensing role with management tools
Install-WindowsFeature -Name RDS-Licensing -IncludeManagementTools
# Verify installation
Get-WindowsFeature -Name RDS-Licensing
After installation, open the RD Licensing Manager tool from Administrative Tools, or use Server Manager under Remote Desktop Services.
Activating the License Server
Before installing CAL licenses, the RD Licensing server must be activated with Microsoft. Activation registers the server with Microsoft’s Clearinghouse and allows the server to issue and track CAL tokens. Activation can be done automatically via the internet, over the telephone, or through a web browser.
# Activate the license server via command line (automatic method)
# Open RD Licensing Manager, right-click the server, choose Activate Server
# Alternatively, activate via wbemtest or WMI
# Check current activation status via WMI
$LicServer = Get-WmiObject -Namespace "rootcimv2TerminalServices" -Class "Win32_TSLicenseServer"
$LicServer.ActivationStatus
# 0 = Not activated, 1 = Activated
For environments without internet access, use telephone activation. The RD Licensing Manager will provide a Product ID code. Call Microsoft’s activation hotline and receive a Licence Server ID in return, then enter it in the wizard.
Installing RDS CALs on the License Server
After activation, install your purchased RDS CAL packs. You will need your license key pack, which is typically a 25-character Product Key delivered with your volume licensing agreement or retail purchase.
# Install CALs via WMI (requires the activation code from Microsoft)
# The standard flow is through RD Licensing Manager GUI:
# Right-click the license server > Install Licenses > Select license program > Enter key pack
# Via WMI - install Per User CALs (ProductType 4 = Windows Server 2019 RDS Per User)
$LicenseServer = Get-WmiObject -Namespace "rootcimv2TerminalServices" -Class "Win32_TSLicenseKeyPack"
$LicenseServer.InstallLicenseKeyPackWithKeyCode("XXXXX-XXXXX-XXXXX-XXXXX-XXXXX")
After installing CALs, the license server will show the total number of installed licenses and the number available for assignment.
Configuring RDSH Servers to Use the License Server
Each RD Session Host must be pointed at the RD Licensing server and must have the correct licensing mode configured. This is done through Group Policy, which is the recommended approach for domain environments as it applies consistently to all RDSH servers in scope.
# Group Policy path:
# Computer Configuration > Administrative Templates >
# Windows Components > Remote Desktop Services > RD Session Host > Licensing
# Equivalent registry settings applied manually or via GPO
$TSPolicyPath = "HKLM:SOFTWAREPoliciesMicrosoftWindows NTTerminal Services"
# Create the key if it does not exist
if (-not (Test-Path $TSPolicyPath)) {
New-Item -Path $TSPolicyPath -Force
}
# Set licensing mode: 2 = Per Device, 4 = Per User
Set-ItemProperty -Path $TSPolicyPath -Name "LicensingMode" -Value 4
# Set the license server hostname(s) - comma-separated for redundancy
Set-ItemProperty -Path $TSPolicyPath -Name "LicenseServers" -Value "rdlic01.corp.local,rdlic02.corp.local"
Joining the License Server to the RD Session Host Computers Group
In a domain environment, add the RD Licensing server to the RDS Endpoint Servers group in Active Directory so that RDSH servers can discover and use it automatically.
# Add the licensing server computer account to the RDS Endpoint Servers group
Add-ADGroupMember -Identity "RDS Endpoint Servers" -Members "RDLIC01$"
# Alternatively, add the licensing server to the Terminal Server License Servers group
# This is required for Per User CAL tracking
Add-ADGroupMember -Identity "Terminal Server License Servers" -Members "RDLIC01$"
Monitoring License Usage
The RD Licensing Manager provides a GUI view of installed licenses and issued CALs. For automated monitoring, use WMI to query license usage and generate reports.
# Query all installed license key packs
$KeyPacks = Get-WmiObject -Namespace "rootcimv2TerminalServices" -Class "Win32_TSLicenseKeyPack"
foreach ($Pack in $KeyPacks) {
Write-Host "Type: $($Pack.TypeAndModel) | Total: $($Pack.TotalLicenses) | Available: $($Pack.AvailableLicenses) | Issued: $($Pack.IssuedLicenses)"
}
# Query issued Per Device licenses
$IssuedLicenses = Get-WmiObject -Namespace "rootcimv2TerminalServices" -Class "Win32_TSIssuedLicense"
$IssuedLicenses | Select-Object sIssuedToComputer, LicenseStatus, ExpirationDate | Format-Table
Configuring License Server High Availability
For production environments, deploy two RD Licensing servers for redundancy. RDSH servers can be configured to contact multiple license servers in sequence. If the primary license server is unavailable, the RDSH server contacts the secondary. CAL packs should be installed on both license servers with equal quantities so either server can issue licenses independently.
# Configure multiple license servers in order of preference
Set-ItemProperty -Path "HKLM:SOFTWAREPoliciesMicrosoftWindows NTTerminal Services" `
-Name "LicenseServers" -Value "rdlic01.corp.local,rdlic02.corp.local"
# Verify the RDSH server can contact the license server
Test-NetConnection -ComputerName "rdlic01.corp.local" -Port 135
Revoking Per Device CALs
Per Device CALs can be revoked and reallocated if a device is decommissioned. Each key pack allows a limited number of revocations (typically 20% of the pack size per year). Revoke licenses through the RD Licensing Manager by right-clicking the issued license and selecting Revoke License, or via WMI.
# Revoke a specific Per Device CAL by computer name
$License = Get-WmiObject -Namespace "rootcimv2TerminalServices" -Class "Win32_TSIssuedLicense" |
Where-Object { $_.sIssuedToComputer -eq "OLDPC01" }
if ($License) {
$License.Revoke()
Write-Host "License revoked for OLDPC01"
}
Grace Period Behaviour
When an RD Session Host cannot contact a valid license server, it enters a 120-day grace period. During the grace period, unlimited temporary licenses are issued and all connections are allowed. When the grace period expires, only the two built-in administrator sessions (console and single RDP session per admin account) are permitted. Users will receive an error message stating that no license server is available. To check the remaining grace period days, query the registry.
# Check grace period status on an RD Session Host
$GraceKey = "HKLM:SYSTEMCurrentControlSetControlTerminal ServerRCMGracePeriod"
if (Test-Path $GraceKey) {
$GraceValue = Get-ItemProperty -Path $GraceKey
Write-Host "Grace period registry entry found - license server may not be configured correctly"
} else {
Write-Host "Grace period key not present - licensing is configured and active"
}
# Check via WMI
$TSLic = Get-WmiObject -Namespace "rootcimv2TerminalServices" -Class "Win32_TSDeploymentLicensing"
$TSLic
Conclusion
Setting up Remote Desktop Licensing on Windows Server 2019 involves installing and activating the RD Licensing role, installing purchased CAL packs, and configuring RD Session Host servers to point to the license server via Group Policy. Monitoring license usage through WMI enables automated alerting before licenses are exhausted. For production deployments, always install two license servers for redundancy and plan capacity based on concurrent session counts and whether Per User or Per Device licensing better fits the environment.