If you ever have tried to remote to a server and the max number of connections are already estabilsted, here’s how to view the sessions remotely and terminate them:
###QWINSTA
View active connections on are remote server
```
C:\Users\jryan>qwinsta /?
Display information about Remote Desktop Sessions.
QUERY SESSION [sessionname | username | sessionid]
[/SERVER:servername][/MODE] [/FLOW][/CONNECT] [/COUNTER][/VM]
```
|Option|Description|
|---|---|
| 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 Remote |Desktop Services counters information.|
| /VM |Display information about sessions within virtual machines.|
``` bash
Example:
qwinsta /server: pc1.domain.com
```
###RWINSTA
Remove the active connections on a remote server
```
C:\Users\ebyrne>rwinsta /?
Reset the session subsytem hardware and software to known initial values.
RESET SESSION {sessionname | sessionid} [/SERVER:servername][/V]
```
|Option|Description|
|---|---|
| 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:
``` bash
rwinsta 2 /server:pc1.domain.com
```
###MSTSC
Another method for stealing control of a server is to use Microsofts Terminal Services Console
``` bash
mstsc -v:192.168.1.2 /admin
```