6

In my company, we're using RDP (Remote Desktop) in order to connect to customers. However, when starting up an RDP session while somebody else is already connected, this other person is kicked out, which is quite annoying.

Is there a way to know that a remote desktop connection is available?

Thanks in advance

1 Answer 1

10

You can find out if someone is already connected to the machine using the command line.

query user /server:<servername>
  • If anyone is connected you will see a line saying active. It is these people you will "kick off".
  • Disconnected means that they were logged in, but have disconnected and not logged out. You are still good to go and connect if this is the case.
  • No User exists means that no one at all is connected.
4
  • 1
    Sorry, neither my Windows machine (Windows-10) nor my Linux subsystem (Ubuntu) recognises that command. From where should I run that command?
    – Dominique
    Feb 16, 2021 at 12:27
  • 2
    @Dominique: The query, quser, and qwinsta tools should be present on any Windows machine which itself has Terminal Services / Remote Desktop Server -- so you'll have them in Windows 10 Pro, but probably not in Windows 10 Home. (Though a company shouldn't be using Windows 10 Home...) Feb 16, 2021 at 12:59
  • 1
    I just run it from a standard Windows powershell prompt. I didn't realise it was a Pro only command... superuser.com/questions/1440493/…
    – Mokubai
    Feb 16, 2021 at 13:02
  • 1
    If you don't have any Win10 Pro systems, then try this PowerShell module. Another alternative is to connect to the target server via SSH or PowerShell Remoting and run query user directly on the server that way. (Well, assuming the server has SSH or WinRM enabled...) It might also be possible to copy just query.exe and quser.exe from someone else's Pro machine -- or even from the server -- and it might just work. Or even hack something together using Python which has the "win32ts" module available as part of pywin32. Feb 16, 2021 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .