andrewlocatelliwoodcock

Thoughts on Software

Archive for September 13th, 2012

Find out who’s logged on to a Remote Desktop Session

with 5 comments

It’s a problem I’ve hit multiple times: I need to remote into a server to do some work but there are only a few sessions available and they’re all in use. I could ask someone if they can log off for a while but as it’s possibly one of a number of people this requires a bulk email. What I really need is a way to identify exactly who is logged onto that server so I can ask them if they can log off for a while …

After a fair amount of googling, I tracked down the query session command for Windows which will do exactly this. Here’s an example:

query session /server:[SERVERNAME]

where [SERVERNAME] is the name of the server you are trying to remote onto. So if we were trying to connect to a server named MyServer, we’d enter:

query session /server:MyServer

Here’s redacted example of the command line query in action

Redacted example of the query session command in action

Redacted example of the query session command in action

There’s a lot more to this command than just the /server switch and the command is covered in detail in a good tech article form Micrsoft available here: http://technet.microsoft.com/en-us/library/bb490800.aspx

 

My next post covers how to forcibly disconnect users from a session when necessary.

Enjoy!

Written by andrewlocatelliwoodcock

September 13, 2012 at 21:41

Follow

Get every new post delivered to your Inbox.

Join 2,712 other followers