Are you facing he error message 'remote session disconnected because there are no remote desktop license servers'?
This guide will help you.
Basically, Remote session disconnected because there are no remote desktop license servers issue applies to deployments that include an RDSH server and a Remote Desktop Licensing server.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve Windows related errors.
In this context, we shall look into causes for this error and ways to fix it.
This licensing error when connecting RDP clients to an RDS host may appear if;
1. On the Remote Desktop Services settings, the RDS licensing server from which we want to get client licenses (RDS CALs) is not specified.
2. The RDS licensing server has run out of available CALs.
3. The RDP client tries to connect with an expired temporary RDS license.
Now let's take a look at the different common issues related to RDS licensing when RDP clients cannot connect to Windows Server with the Remote Desktop Services Host role installed.
1. Remote session was disconnected because there are no Remote Desktop client access licenses available for this computer
Recently, one of our customers was getting RDS CALs from the license server.
i. First, we connect to the RDSH server in administrative mode (mstsc.exe /admin) and run the RD Licensing Diagnoser tools.
ii. Here, we see the name of the RDS licensing server, and the type of license (Per User/Per Device).
iii. Next, we connect to the RDS license server using the RD Licensing Manager console (licmgr.exe).
iv. Then we check if we have available free licenses of the required type (Per User or Per Device).
In case, if we run out of free RDS CALs, we may need to purchase a new CAL pack, we wait for someone to release the license, or revoke unused licenses directly from the console (right-click on the computer/user and select Revoke License).
v. In this case, the client computer is trying to connect to the RDSH server with an expired temporary RDP license (if the RDS license server was unavailable when the client first connected, the client was issued a temporary RDP license for 180 days).
vi. So, we need to reset this license in the registry on the client device.
To reset the license, follow the below steps:
a. First, we start the Registry Editor (regedit.exe);
b. Next, we remove the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\MSLicensing;
c. Then we close the registry editor and run the mstsc.exe (Remote Desktop Connection) as an administrator;
d. Finally, we connect to the RDS server. In this case, the MSLicensing reg key will be automatically re-created, and the computer will receive a new RDP license.
2. The remote session was disconnected because there are no Remote Desktop License Servers available to provide a license
One of our customers has encountered a problem with the deployed farm of RDS servers on Windows Server 2012 R2.
The RDS server had stopped issuing terminal licenses to users.
However, the installation and configuration of the license server role were made, and RDP CALs had been activated.
i. In order to resolve this, we first, connect to the server console in administrative mode (mstsc /admin).
ii. Next, we open the Server Manager, and go to the RDS settings (Remote Desktop Services >> Deployment Overview >> Tasks >> Edit Deployment Properties).
iii. Also, we make sure that the correct Remote Desktop license server and RDS CAL type (Per Device or Per User) are specified in the RDSH configuration.
iv. We can also check the RDS licensing server settings via PowerShell:
v. Then we check if the below ports are not blocked by firewalls when accessing from the RDSH host to RDS LicenseingServer:
TCP 135, UDP 137, UDP 138, TCP 139, TCP 445, TCP 49152–65535 (RPC range).
If the RDS License server is not available, the License Diagnoser will display an error:
License server rdslic_hostname is not available. This could be caused by network connectivity problems, the Remote Desktop Licensing service is stopped on the license server, or RD Licensing isn't available.
In the Event Viewer on the RDS host, we can see an error like this:
Source: TerminalServices-RemoteConnectionManagerThe RD Licensing grace period has expired and the service has not registered with a license server with installed licenses. A RD Licensing server is required for continuous operation. A Remote Desktop Session Host server can operate without a license server for 120 days after initial start up.
The RD License Diagnoser will most likely also display an error:
The grace period for the Remote Desktop Session Host server has expired, but the RD Session Host server hasn't been configured with any license servers. Connections to the RD Session Host server will be denied unless a license server is configured for the RD Session Host server.
This means that the grace period for the RDSH server has expired. So we need to extend the grace mode or activate the host on an RDS license server.
We can find the number of days before the end of the RDS Grace Period from the elevated command prompt:
wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting WHERE (__CLASS !="") CALL GetGracePeriodDays
In order to extend the grace period in RDS, we need to remove the registry parameter on the server. It determines the grace period licensing time. The date that determines the RDS grace period for the server is present in the reg_binary registry parameter L$RTMTIMEBOMB located in the following registry key:
Now, we need to remove the RTMTIMEBOMB parameter from the registry. However, the administrator does not have enough permissions to do this.
Unable to delete all specified values.
To remove this registry parameter, we open the parent key permissions and grant the account the privileges of the key owner. Then we set the Full Control permissions for the Administrators group.
Next, we right-click L$RTMTIMEBOMB parameter and delete it.
After that, we restart the RDSH server and connect to it using the RDP client. Also, we make sure that the RDS CAL has been issued successfully using the Remote Desktop Licensing Manager.
Then using this PowerShell command, we make sure if the RDS licensing server is set:
$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting
If the RDS licensing server is not set (SpecifiedLSList is empty), we force to set the RD licensing server with the following command:
$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting
The RDS host will now be able to obtain licenses from the RDS Licensing server and issue them to the RDP users.
This article covers how to resolve the error 'remote session disconnected because there are no remote desktop license servers'.
If the problems tend to be associated with the following user messages:
i. The remote session was disconnected because there are no Remote Desktop client access licenses available for this computer.
ii. The remote session was disconnected because there are no Remote Desktop License Servers available to provide a license.
Then, configure the RD Licensing service by following the steps below:
1. Open Server Manager and navigate to Remote Desktop Services.
2. On Deployment Overview, select Tasks, and then select Edit Deployment Properties.
3. Select RD Licensing, then select the appropriate licensing mode for your deployment (Per Device or Per User).
4. Enter the fully qualified domain name (FQDN) of your RD License server, and then select Add.
5. If you have more than one RD License server, repeat step 4 for each server.
If the RD License Diagnoser lists other problems, such as "The RDP protocol component X.224 detected an error in the protocol stream and has disconnected the client," there may be a problem that affects the license certificates. Such problems tend to be associated with user messages, such as the following:
Because of a security error, the client could not connect to the Terminal server. After making sure that you are signed in to the network, try connecting to the server again.
In this case, refresh the X509 Certificate registry keys by following the steps given below:
To resolve this problem, back up and then remove the X509 Certificate registry keys, restart the computer, and then reactivate the RD Licensing server.
1. Open the Registry Editory and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM.
2. On the Registry menu, select Export Registry File.
3. Enter exported- Certificate into the File name box, then select Save.
4. Right-click each of the following values, select Delete, and then select Yes to verify the deletion:
ii. X509 Certificate
iii. X509 Certificate ID
iv. X509 Certificate2
5. Exit the Registry Editor and restart the RDSH server.
To fix Remote session was disconnected because there are no Remote Desktop client access licenses:
1. You need to delete the following registry key:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSLicensing.
2. If it doesn't work and you get the following error message: "The remote computer disconnected the session because of an error in the licensing protocol";
3. Then all you need to do is Right-Click on the Remote Desktop Connection icon and select "Run as Administrator".