Please wait,
Processing your request...

  Business logo
  ... | Selecteer de Nederlandse taal |
Sharing is caring
| Print this page. | Linkedin page of Johan van Soest

React: Postcard image. Click this to mail to Johan


ICT-Hotlist Topic

How to stop a RDP session so you can log on to remote desktop again.

The Remote Desktop Protocol (RDP) is a robust technology of Microsoft to take over and manage remote servers and PC's/Notebooks. RDP shows the user a graphical console of the other computer and allows the sending of key strokes and mouse movements to the same computer and even receive sound. Most servers allow up to 2 RDP sessions for system management, otherwise Client Access Licenses (TS-CAL's/RDP-CAL's) should be acquired and user(groups) must be added to the remote users group by "Select users who can use remote desktop"(Windows desktops), by Group policies or by the terminal server manager.
Adding Remote Desktop Users on a Windows 10 desktop
Adding Remote Desktop Users on a Windows 10 desktop

RDP is refused.

When you are locked out of an RDP connection with the error : "The terminal server has exceeded the maximum number of allowed connections", there are probably 2 sessions not correctly logged off and are still active. There are two strategies without rebooting the server.
  1. RDP to the console of the server and stop the sessions using Task Manager, tab "Users" and disconnect the user sessions.
  2. Stop a session on the (remote) server (Also works on Citrix)

RDP to the server console to stop a session

By using the following command line code you start a Console session.
mstsc /admin
Next you have to enter an IP-address or server name in the dialog. Than start Task Manager, select the tab "Users" and stop the sessions. Now you should able to logon with RDP.

Locate the server sessions and stop these.

First get the session ID's of the running Remote Desktop protocol sessions by using the command:
query session /server:<server name or IP-address>

For example:

C:\>query session /server:nlaaldc1
 SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
 console                                     0  Conn    wdcon
 rdp-tcp                                 65536  Listen  rdpwd
 rdp-tcp#79        administrator             2  Active  rdpwd
 rdp-tcp#73        administrator             1  Active  rdpwd
Now you can terminate the RDP session with the Session ID using the command line interface command:
reset session <session-id> /server:<server name or IP-address>

For example:

reset session 2 /server:nlaaldc1
Now you should able to logon with RDP.

Standardize on RDP

On several Linux systems xrdp can be installed. This allow taking over a Linux console with Windows Remote Desktop tools. You receive a Linux X window to manage the machine.
You may vote your opinion about this article:

Scripts and programming examples disclaimer

Unless stated otherwise, the script sources and programming examples provided are copyrighted freeware. You may modify them, as long as a reference to the original code and hyperlink to the source page is included in the modified code and documentation. However, it is not allowed to publish (copies of) scripts and programming examples on your own site, blog, vlog, or distribute them on paper or any other medium, without prior written consent.
Many of the techniques used in these scripts, including but not limited to modifying the registry or system files and settings, impose a risk of rendering the Operating System inoperable and loss of data. Make sure you have verified full backups and the associated restore software available before running any script or programming example. Use these scripts and programming examples entirely at your own risk. All liability claims against the author in relation to material or non-material losses caused by the use, misuse or non-use of the information provided, or the use of incorrect or incomplete information, are excluded. All content is subject to change and provided without obligation.
Generated by WebHalla™ Version 0.1.e.7 : Thursday 30-5-2024 © Copyright 1995-2024 ing. Johan P.G. van Soest CIPM Certified Privacy Information Manager
Response Form    Cookie- and Privacy statement    Responsible Disclosure procedure
Weather in Waalre by OpenWeatherMap logo broken clouds
Temperature 14.57 °C broken clouds
Wind chill 14.43 °C broken clouds
Humidity 90 % broken clouds
Air pressure 1006 hPa broken clouds
Wind speed 2.57 m/s broken clouds
Wind direction South West South West broken clouds
Sun Rise 5:28 Sun Rise
Sun Set 21:43 Sun Set
Updated:2024-05-30 09:27:59 broken clouds

Weather Cache is 7 minute(s) old.
| Current user: Guest | Login |