Every now and then, user who attempts to establish Terminal Services or Remote Desktop connection to Windows 7, Windows Vista, Windows Server 2008 (R2), Windows Server 2003, Windows Server 2000, Windows Home Server or other RDP-supported server may encounter “the terminal server has exceeded the maximum number of allowed connections” error message.

The error happens because the there previous sessions or existing RDP connections to the server or host which were not disconnected or terminated properly. To make matter worse, if the only Terminal Server on the network has been fully connected to by remote clients, and no extra slots available, it’s possible for administrator to remotely sign onto the server to use Terminal Services Manager to kill the any RDP connections.

Instead of restarting or rebooting the host or server which user wants to remote desktop into or remote control, here’s alternative workaround methods to remotely disconnect or terminate the “stuck” Terminal Services or Remote Desktop sessions and connections.

Method 1

  1. The Terminal Services Manager or Remote Desktop Services Manager can be used to disconnect and reset any Terminal Services or Remote Desktop connections. Depending on operating system, there are different ways to start and run Terminal Services Manager.

    Windows XP and Windows Server 2003 or earlier:

    Click on Start -> Run and type %SystemRoot%\System32\tsadmin.exe

    Windows Vista Windows Server 2008:

    Click on Start and type tsadmin.msc into Start Search box.

    Windows 7 and Windows Server 2008 R2 or later:

    Click on Start and type Remote Desktop Services Manager into Start Search box.

    Tip: On client operating system or workstation, Remote Server Admin Tools (RSAT) has to be installed for the Manager to exist.

  2. Once the Remote Desktop Services Manager or Terminal Services Manager is launched, right click on “Remote Desktop Services Manager’ or “All Listed Servers” and select Connect to Computer.
  3. Then, type in the name or IP address of the server running Remote Desktop Services that wants to be managed.

    Log on to the remote server if required.

  4. Authenticated server will be listed on the left pane. Select the applicable server with not responding Remote Desktop session.
  5. On the right pane, go to Sessions pane.
  6. Right click on the session that wanted to be disconnected and select Disconnect.

Method 2

  1. Launch a Command Prompt window.
  2. Authenticate to the remote computer by using the following “net use” command:

    net use /user:Administrator \\<server name or IP address>\C$

    Replace <server name or IP address> with actual NetBIOS computer name or IP address of the remote host. For example, “net use /user:Administrator \\188.8.8.8\C$.

    Enter password when prompted.

  3. Terminate any existing Remote Desktop or Terminal Services connections with the following command:

    reset session <n> /server:<server name or IP address>

    Replace <server name or IP address> with actual NetBIOS computer name or IP address of the remote host. For <n>, enter a number incrementally starting from 1, 2, 3 …, until a message “session ID n not found” is been returned as error when executing the command. For example, “reset session 1 /server:188.8.8.8”.

    Tip: No notification message will be displayed when a session is successfully terminated.

Method 3

  1. Launch a Command Prompt window, and authenticate to the remote host by using the following “net use” command:

    net use /user:Administrator \\<server name or IP address>\C$

    Replace <server name or IP address> with actual NetBIOS computer name or IP address of the remote host. For example, “net use /user:Administrator \\188.8.8.8\C$.

    Enter password when prompted.

    Alternatively, from Windows Explorer, map to a network drive to share a folder on the target server, and log in accordingly.

  2. In Command Prompt, run the following command:

    qwinsta /server:<server name or IP address>

    Where <server name or IP address> is the actual computer name or IP address of the remote host. For example, “qwinsta /server:188.8.8.8”.

  3. A list of active and connecting Remote Desktop or Terminal Services sessions will be displayed. Identify the ‘hung’ connection and its ID.
  4. To reset and disconnect the Remote Desktop connections or sessions, run the following command:

    rwinsta <ID> /server:<server name or IP address>

    Replace <ID> with the session ID identified with “qwinsta” command, and <server name or IP address> with the actual computer name or IP address of the remote host. For example, “rwinsta 1 /server:188.8.8.8”

Note: qwinsta is Query Window Station and rwinsta is Reset Window Station.

Once a Remote Desktop or Terminal Services connection or session is terminated and disconnected, the slot will be released and remote user can login remotely again.

Related Posts