Server 08 RDP: possible to warn if same user is already connected?

5,296

Some bad news for you: There is no way to get RDP to warn you when you are about to log in to an existing session. It only warns when you are going to log in via RDP and another user is already logged in. sad face


Wait... it might be theoretically possible using remote scripting. You can use the query command and the user option to get a list of logged on users. You could then search for the username that interests you and see if the ACTIVE tag is in the STATE column. From there, you could invoke an .rdp file if the user is not logged on or send a warning dialog if the user is logged on.

It's homemade, but it should work.

Example from one of my Windows servers:

C:\Users\BigKahuna>query user
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
>BigKahuna          rdp-tcp#0           1  Active          .  3/26/2012 6:51
PM
Share:
5,296

Related videos on Youtube

Trent
Author by

Trent

Updated on September 18, 2022

Comments

  • Trent
    Trent over 1 year

    Currently we do some development and monitoring over 1 RDP account (administrator) to a server 2008 r2 machine, as everyone needs to share the same instance of everything to ensure consistency. The problem is that while one person is connected and working away, if someone else tries to connect using the same account, it will boot the first person off and yield control to the second person. The only warning comes a bit too late, when the first person receives a message saying "Another user connected to the remote computer, so your connection was lost".

    Is there any known way to warn the incoming user that someone is already connected (similar to the type of message you might get when working with different accounts), or to allow the victim the option of not being booted?

  • Wesley
    Wesley about 12 years
    @Trent It's the only way to get this done, and it's not such a huge deal. Look into WinRM and PowerShell Remoting. It's just a simple matter of running a few commands, storing a few things in variables and an if statement or two.
  • Trent
    Trent about 12 years
    Actually since "query user" is just a dos command, any programming language could execute and parse it. We have a web server running on the machine, so I think I will just write a browser-accessible perl or php script to do it. Should be a 1-liner. Thanks
  • Wesley
    Wesley about 12 years
    @Trent Awesome! Hope it works out.