Yesterday I was attempting to remote desktop into one of the production SQL servers and all of the sessions were taken. I thought I would open up the Terminal Services Manager on another SQLsServer within the same domain to either disconnect or log off a user session for the original server I was attempting to access. As I opened up the Terminal Services Manager I noticed that the I was not able to “see view” the original server within the Terminal Services Manager. So the other way I would be able to do it would be through the command prompt. Follow the steps below to view and kill remote desktop sessions on your server.
- Log into a server on the domain and open a windows command prompt
- To view current connections on a server type: qwinsta /server:<server name or ip address>
- When the results are displayed pick an ID value that has a state of “Disc” (Disconnected)
- To kill a session pick the ID with the state of “Disc” and type the following
- rwinsta <ID Value> /server:<server name or ip address>
The remote desktop session has been killed and you are now able to Remote Desktop into your original SQL Server. If you are asking yourself what does qwinsta and rwinsta mean… well here they are:
qwinsta = Query WINdows STAtion
rwinsta = Reset WINdows STAtion
I hope you have found this useful… I will be adding more administrative tips and tricks on my blog so keep checking back!
– Squirrel
The post How To Kill Remote Desktop Connections appeared first on LockerGnome.