How to reset a terminal service connection for Windows server

Jephe Wu -  http://linuxtechres.blogspot.com


Objective: reset Windows terminal service connection for remote Windows servers
Environment: Windows 2003 servers


Steps:
1. run qwinsta command to query remote windows login session
From Windows command prompt, run command:
qwinsta /server:1.2.3.4
rdp-tcp#471 Jephe 2 Active rdpwd

2. reset sessions for remote Windows server
rwinsta /server:1.2.3.4 2


Note:
a.  What do the qwinsta and rwinsta stands for?
qwinsta = Query WINdows STAtion
rwinsta = Reset WINdows STAtion

3. how to disconnect a session in Windows 2000
The following information is from Microsoft website - How to Disconnect a Terminal Services Session http://support.microsoft.com/kb/321705

This is an example of how to use the tsdiscon command to disconnect a session on the current Terminal Services server:

  1. In a Terminal Services session, click Start, and then click Run.
  2. Type cmd, and then click OK.
  3. Determine the name or ID of the session that you want to disconnect. To do so, type query session, and then press ENTER. You see a list of information about the sessions on the current Terminal Services server. The list may be similar to:
    SESSIONNAME   USERNAME        ID      STATE    TYPE    DEVICE
     console      administrator       0   active   wdcon   
     rdp-tcp                      65536   listen   rdpwd
    >rdp-tcp#1    user1               1   active   rdpwd
     rdp-tcp#2    user1               2   active   rdpwd
     rdp-tcp#3    user2               3   active   rdpwd
     rdp-tcp#4    user3               4   disc     rdpwd  
     rdp-tcp#5    user1               5   disc     rdpwd
                                      6   idle
                                      7  idle
          
    Note that in this example, the name of the current session is rdp-tcp#1, the session ID is 1, and it is owned by user1.
  4. To disconnect the current session, type the following line at the command prompt, and then press ENTER:
    tsdiscon
  5. To disconnect session 2 by using the session ID, and to display information about the disconnect operation, type the following line at the command prompt, and then press ENTER:
    tsdiscon 2 /v
    You see the following line and session 2 is disconnected:
    Disconnecting sessionID2 from sessionname rdp-tcp#2
  6. To disconnect session 5 by using the session name, type the following line at the command prompt, and then press ENTER:
    tsdiscon rdp-tcp#5