View connection: qwinsta
Usage:
Display information about Terminal Sessions.
Query session [sessionname | username | sessionid]
[/SERVER: servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER]
Sessionname Identifies the session named sessionname.
Username Identifies the session with user username.
Sessionid Identifies the session with ID sessionid.
/SERVER: servername The server to be queried (default is current ).
/MODE Display current line settings.
/FLOW Display current flow control settings.
/CONNECT Display current connect settings.
/COUNTER Display current Terminal Services counters information.
Example: qwinsta/server: test-machine
Display result
SESSIONNAME USERNAME ID STATE TYPE DEVICE
Console 0 Conn wdcon
Rdp-tcp 65536 Listen rdpwd
Gogboy 1 Disc rdpwd
Sunny 2 Disc rdpwd
The result shows that two common users (Gogboy, Sunny) keep their sessions on the machine (test-machine. You can use the following rwinsta section to open
Disconnected: rwinsta
Usage:
Reset the session subsytem hardware and software to known initial values.
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.
Example: rwinsta 2/server: test-machine
In this way, the above user's Sunny session is disconnected from the machine.