Contents

List and reset or Shaow RDP sessions

Contents

Note: you need Admin privilege to do things below.
 
Error Message :
The terminal server has exceeded the maximum number of allowed connections.

Cause:
Normal server only allow 2 sessions of RDP. 

If someone didn’t log off properly, and left the server with a disconnected session, that session will stay there until it to be reset.



Listing :
Pay attention to session name and ID, they will be used to be terminated later on. 
H:>qwinsta /server:server1
 SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
 console                                     0  Conn    wdcon
 rdp-tcp                                 65536  Listen  rdpwd
 rdp-tcp#25        admin1                    5  Active  rdpwd
 rdp-tcp#16        admin2                    7  Active  rdpwd

Reseting:
Command Sytax. Sometimes session name is not available, you can use session ID.
RESET SESSION {sessionname | sessionid} [/SERVER:servername] [/V]

  sessionname         Identifies the session with name sessionname.
  sessionid           Identifies the session with ID sessionid.
  /SERVER:servername  The server containing the session (default is current).
  /V                  Display additional information.

H:>reset session rdp-tcp#16 /server:server1 /v
Resetting session rdp-tcp#16
Session rdp-tcp#16 has been reset

H:>reset session 5 /server:server1 /v
Resetting session ID 5
Session ID 5 has been reset

Shadowing:
Mstsc.exe [/shadow:sessionID [/v:Servername] [/control] [/noConsentPrompt]]  
For example:    mstsc /shadow:5 /v:server1 /control /noConsentPrompt
Note: noconsentPrompt might be blocked by GPO. 


Another way to reset:
RDP to a server which is a Terminal Server,(Terminal Server can be installed by “Manage Your Server -> Server Role”) start the"Terminal Services Manger” and connect to the first server. From there you can reset a session.