Fix it now
Event 21 says the licence server has no remaining permanent RDS CALs of the type a Session Host asked for. Microsoft’s own first instruction is to verify that the licensing mode on the Session Host matches the type of CAL installed – that mismatch produces this event on a server with plenty of licences, and costs nothing to fix.
- Read the event text on the licence server. It names the CAL type it could not issue and the Session Host that asked.
- Check the licensing mode on that host: LicensingMode is 2 for Per Device and 4 for Per User. If it does not match the CALs you own, that is the whole answer.
- Correct it with
Set-RDLicenseConfiguration -Mode PerUser -ConnectionBroker cb.contoso.local, or through the Licensing policy, thengpupdate /force. - If the mode is right, open Remote Desktop Licensing Manager and read Installed against Issued for that product and type.
- For Per Device CALs only, reclaim licences from retired machines: select the installed CAL version node, select an issued CAL, then Action, Revoke RDS CAL.
Event 20 is the same situation earlier: it warns when only a small number of permanent CALs remain. Alert on it and you avoid Event 21.
If clients are being issued CALs again you can stop here. If not, the next section covers the two companion events and what they change.
Why it happens
Event 21 is written by Microsoft-Windows-TerminalServices-Licensing on the licence server, and its text is specific: the licence server does not have any remaining permanent RDS CALs of a named type, so it cannot issue CALs of that type to a named Session Host. It then gives two remedies in order – verify that the Remote Desktop licensing mode configured on the RD Session Host matches the type of RDS CALs installed on the licence server, and, if required, purchase and install additional RDS CALs.
The order matters, because the first remedy is free and the second is not. A Session Host set to Per Device asks for a Device CAL. A licence server holding only User CALs has none of those, however many User CALs are sitting unissued next to them, and it logs Event 21 saying so. From the client’s side this is indistinguishable from having run out.
Event 45 is a different fault that shows up in the same investigation: “The Remote Desktop license server cannot communicate with another Remote Desktop license server because of the following error.” Licence servers exchange information about the CALs they hold, and when they cannot, each one sees only its own pool. In a deployment with more than one licence server that produces exactly the pattern people describe as “we have plenty of CALs and it still fails”.
Event 19 is about certificates rather than counts: “One or more RD Licensing certificates on the Remote Desktop license server are corrupted. The Remote Desktop license server is switching to a backup certificate.” That is a warning the server is running on its fallback. Its neighbour, Event 17, says the certificates are corrupted and the server will only issue temporary licences until it is reactivated – which is the point at which a certificate problem becomes a user-visible one.
None of these three is the event for a licence server that was never activated. That is Event 18, and it says so in plain words: the server has not been activated and will therefore only issue temporary licences.
The licensing mode does not match the CALs installed
You have this one if Event 21 naming a CAL type you do not own, while Remote Desktop Licensing Manager shows plenty of the other type unissued.
- Read the CAL type from the event text – it is quoted in the message.
- Check the mode on the named Session Host and change it to match:
Set-RDLicenseConfiguration -Mode PerDeviceor-Mode PerUser. - Apply through Group Policy if the hosts are in a GPO scope, because policy overrides the console, then
gpupdate /force. - Reconnect a test client and watch the issued count move.
This is Microsoft’s own first instruction in the event text. Work through it before counting anything.
The permanent CALs really have run out
You have this one if Event 21, the mode is correct, and Issued equals Installed for that product and type.
- For Per Device CALs, reclaim from retired machines: select the installed CAL version node, select an issued CAL, then Action, Revoke RDS CAL. A revoked CAL is available again immediately.
- Per User CALs cannot be revoked, so for those the only route is to install more.
- Buy CALs matching your newest Session Host version, and check the licence server can hold them – it must run the same Windows Server version as the CALs or later.
No more than 20 per cent of the installed CALs of a version may be in a revoked state at once, so revocation buys headroom rather than a permanent extra allowance.
Licence servers cannot see each other’s pools
You have this one if Event 45 on one or more licence servers, in a deployment that has more than one.
- Read the error code carried in the Event 45 text; it names the underlying failure.
- Confirm RPC connectivity between the licence servers: TCP 135 plus the dynamic range TCP 49152 to 65535.
- Check for related Events 7, 8 and 15, which record a server too busy to notify others, unable to communicate with others, and unable to announce newly installed CALs.
- Confirm both servers are activated and running the Remote Desktop Licensing service.
The licence server’s certificates are damaged
You have this one if Event 19, and possibly Event 17, on the licence server.
- Note whether you have 19 (switched to a backup certificate) or 17 (corrupted, issuing temporary licences until reactivated).
- Reactivate the licence server from Remote Desktop Licensing Manager: Action, Advanced, Reactivate Server.
- Where reactivation does not clear it, back up and refresh the X509 Certificate values under
HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM, restart, then reactivate. - Watch for Events 57 and 58 while installing CAL packs afterwards, which indicate the installation path needs the Telephone method.
Full reference
The three events, side by side
| Event | Source | What it says |
|---|---|---|
| 21 | TerminalServices-Licensing | No remaining permanent RDS CALs of the named type; verify the Session Host’s licensing mode matches the CALs installed, then buy more if needed |
| 45 | TerminalServices-Licensing | The licence server cannot communicate with another licence server, with the underlying error |
| 19 | TerminalServices-Licensing | One or more RD Licensing certificates are corrupted; the server is switching to a backup certificate |
One caution about low event numbers on a Remote Desktop server: they are reused across sources. Event 21 in the Session Host’s own log is an ordinary successful session logon, and Event 19 in the Remote Desktop Services availability log is a Service Control Manager registration retry. Read the source and the log before acting on a two-digit event number.
Events worth alerting on, in order of usefulness
| Event | Meaning | Why it matters |
|---|---|---|
| 20 | Only a small number of permanent CALs remain for a product | The warning before Event 21. Alert here and you never see 21 |
| 21 | No permanent CALs of that type remain | Users are now being refused or issued temporary licences |
| 18 | The licence server has not been activated | Only temporary licences are being issued |
| 17 | Licensing certificates corrupted; temporary licences only until reactivated | A quiet failure that surfaces weeks later |
| 19 | Switched to a backup certificate | Working, but on its fallback |
| 26 | All available CALs of a type have been removed | Usually a rebuilt or restored licensing database |
Activating a licence server
- Open Server Manager, Tools, Remote Desktop Services, Remote Desktop Licensing Manager.
- Select the server, then Action, Activate Server.
- Choose the connection method: Automatic connection uses outbound TCP 443 to the Microsoft Clearinghouse; Web Browser suits a server with no internet access where you have it elsewhere; Telephone is the fallback and is also the method Events 57 and 58 tell you to use.
- Enter the required company information.
- Run Action, Install Licenses and enter the agreement or licence number for the programme you bought under.
Per User and Per Device compared
| Per Device | Per User | |
|---|---|---|
| Revocation | Up to 20 per cent of installed CALs | Not possible |
| Temporary CALs | 90 days on first sign-in | Not available |
| Permanent CAL validity | 52 to 89 days before renewal | 60 days before renewal, 90 before reassignment |
| Tracking | Works regardless of Active Directory membership | Requires Active Directory; cannot be tracked in a workgroup |
| Over-allocation | Not possible | Possible, and a breach of the agreement |
That last row explains why Per User deployments run out quietly rather than loudly. A Per User pool can be over-allocated, so the enforcement you feel is weaker than the entitlement you hold, and Event 21 for a User CAL type is a compliance signal as much as an availability one.
When the counts and the mode are both right
- Check for Event 4141 on the licence server, which records a licence refused because the requesting host is not in the Terminal Server Computers group.
- Check the CAL version against the Session Host’s Windows Server version; older CALs do not licence newer hosts.
- Check whether a second licence server holds the CALs you are counting and cannot be reached – that is Event 45.
- Confirm the licensing database is healthy: Events 9, 24, 25, 44 and 47 all describe an RD Licensing database that is invalid, inconsistent, foreign or corrupt.
- Confirm the Remote Desktop Licensing service is running and the RPC port is listening; Event 4104 says explicitly when it is not.
When a licence is the actual fix
Read the event text before ordering, because Microsoft’s own first remedy is free: verify that the licensing mode on the Session Host matches the type of RDS CAL installed on the licence server. A Per Device host asking a server that holds only User CALs produces Event 21 with a full shelf of licences sitting there. Once that is ruled out, and once Per Device CALs have been reclaimed from retired machines by revocation, whatever remains is a genuine shortfall. Choose the type to match how people work: User CALs where staff connect from several devices each, Device CALs where machines are shared between shifts. Buy the CAL version matching your newest Session Host – later CALs licence earlier hosts, never the reverse – and check that your licence server runs the same Windows Server version as the CALs or later, or the packs will not install. RDS CALs are additional to Windows Server CALs, not a replacement for them. Tell Arco your host and licence server versions and your user or device count and we will supply packs that install first time.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
Event ID 21 |
TerminalServices-Licensing on the licence server: no remaining permanent RDS CALs of the named type, so none can be issued to the named Session Host. Verify the host’s licensing mode matches the CAL type installed before purchasing more | Microsoft Learn |
Event ID 45 |
“The Remote Desktop license server cannot communicate with another Remote Desktop license server because of the following error” – an inter-licence-server communication failure | Microsoft Learn |
Event ID 19 |
“One or more RD Licensing certificates on the Remote Desktop license server are corrupted. The Remote Desktop license server is switching to a backup certificate” | Microsoft Learn |
Confirm the fix worked
- The licensing mode on every Session Host matches the CAL type installed on the licence server.
- Remote Desktop Licensing Manager shows Issued below Installed for the type being requested.
- Event 21 stops recurring after a test client connects.
- Where multiple licence servers exist, Event 45 has stopped and each server can see the others.
- The licence server shows as activated, with no Event 17, 18 or 19 following the change.
Questions people ask about this
Does Event 21 mean the licence server was never activated?
No. Event 21 means it has no remaining permanent CALs of the type being asked for. The event for a server that was never activated is Event 18, which says it will only issue temporary licences.
We have hundreds of unissued CALs and still get Event 21. How?
Almost always a mode mismatch. A Per Device Session Host asks for Device CALs, and a server holding only User CALs cannot satisfy it however many it has. Microsoft’s own first instruction in the event text is to check exactly this.
Event 21 appears in another log with a completely different meaning. Which is right?
Both, for their own source. Two-digit event numbers are reused across Remote Desktop sources: Event 21 from TerminalServices-Licensing is the CAL shortage, while Event 21 in the Session Host’s local session manager log is an ordinary successful logon. Always read the source.
Can I get CALs back from machines we have retired?
For Per Device CALs, yes: revoke them one at a time from Remote Desktop Licensing Manager, and each one returns to the pool immediately, subject to a cap of 20 per cent of the installed CALs of that version. Per User CALs cannot be revoked.
What should we alert on so this does not happen again?
Event 20. It warns while a small number of permanent CALs remain for a product, which is the same situation as Event 21 but with time to act. Add Events 17, 18 and 45 to the same alert set.
