When Does This Error Show Up?
You’re connecting to a Windows Server via Remote Desktop Services (RDS) or trying to access a shared folder on a file server. Everything works fine for a while. Then, one day—usually after a few dozen users logged in and out—you get a popup with STATUS_LICENSE_QUOTA_EXCEEDED (0xC0000259). The server refuses the connection. You might also see this in Event Viewer as source LSM or TermServLicensing.
What Actually Causes It
Windows Server licensing works on a per-user or per-device CAL (Client Access License) model. For Remote Desktop Services, the server tracks licenses issued to clients. When you hit the maximum number of licenses allowed by your purchased CALs, the server stops new connections. The same applies to file shares if you’re using Windows Server’s built-in file server role with CAL enforcement — though that’s rarer. The error code 0xC0000259 is the NT status code for “license quota exceeded.” The server says, “I’m out of tokens, go away.”
The tricky part: licenses can get stuck. If a client disconnects abruptly (power loss, network drop), the server might not release the license immediately. Over time, those orphaned licenses pile up, and you hit the quota even though fewer users are actually connected.
The Fix — Step by Step
I’ve done this on Windows Server 2012 R2, 2016, 2019, and 2022. It works every time. You don’t need to reboot the server.
Step 1: Check Current License Usage
Open Remote Desktop Licensing Manager (search for licmgr.exe). Connect to your license server (usually the same server). Look at the Installed Licenses tab. You’ll see a count like “2 of 5 licenses issued.” If it’s full or close to full, that’s your problem.
Also check Remote Desktop Services Manager (search for mstsc.exe and run mstsc /admin to connect, then open the manager from there). See how many sessions are actually active. If the licensing manager shows 50 licenses used but only 3 active sessions, you have orphaned licenses.
Step 2: Revoke Orphaned Licenses
In Licensing Manager, right-click the license server and select Revoke Licenses. This forces the server to re-verify each license. It will send a request to Microsoft’s clearinghouse (requires internet access). For per-device CALs, each device will need to re-authenticate, which happens automatically on next connection. For per-user CALs, users get a new license transparently.
If you’re offline or the server can’t reach Microsoft, you have one more option: delete the license cache. Stop the Remote Desktop Licensing service. Navigate to C:\Windows\System32\LServer, delete the LicenseCache folder (yes, all of it). Restart the service. This wipes all issued licenses and starts fresh. Users reconnect and get new ones. Do this only if you’re desperate — it’s a sledgehammer approach.
Step 3: Extend Grace Period (Temporary Fix)
If you’re waiting for new CALs to arrive, you can reset the RDS grace period. This gives you 120 more days (per the built-in grace timer). Run this command as Administrator:
wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting WHERE TerminalServerMode=1 CALL ChangeMode 2This switches the licensing mode to “Per Device” (mode 2). Then switch it back to your actual mode afterward if needed. The grace period resets. Don’t rely on this—it’s a crutch.
What If It Still Fails?
If the error persists after revoking licenses, you likely have a license server reachability problem. Check that the server’s DNS record points to the correct IP. Run nslookup yourlicenseserver. If it’s wrong, the client can’t talk to the license server and falls back to “no available licenses.” Also verify port 135 (RPC) and 139/445 (SMB) are open between client and server for licensing communication. Firewall rules on the license server can block the licensing protocol entirely — I’ve seen that more than once.
One more thing: if you’re using Remote Desktop Services in an RDS farm, make sure all session hosts point to the same license server. Mismatched servers cause the quota to appear full on one side but empty on the other. That’s a configuration mess, not a license shortage.