How to: do a quick check on who is connected to the server via RDP

Apart from obvious ways to do it via Windows Server GUI which is the long way (plus if you working with multiple versions like Server 2003 and 2008 it differs slightly and requires you to remember the “path” through GUI to find this information) there are CLI tool to accomplish this:

qwinsta available starting from Windows XP, if run locally lists RDP connections to local host and alternatively it can do this for remote machines (in the same domain) if run with /server key:

qwinsta /server:%SERVERNAME%

Output of this command gives you list of users connected to server along with their session ID, which you can use to disconnect sessions via command line with help of the second tool rwinsta which can be used with following syntax:

rwinsta /server:%SERVERNAME% %SESSION_ID%

Note on etimology of those commands:

qwinsta stands for Query WINdows STAntion

rwinsta stands for Reset WINdows STAntion

Starting from Windows Server 2003 you can also use query session command for the same purpose.

Leave a Reply

Your email address will not be published. Required fields are marked *