Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have a common Windows XP machine that's shared between multiple users. All of them use a common domain login to rdp into it. Now the problem is, we some times end up taking over other persons active session without either party being warned (no warning is issued as we use same login).

Is there a way to test if the current logged in user on remote machine is active (terminal locked?) or not?

We can not use VNC or LogMeIn or other desktop sharing utilities for security reasons (blocked by IT).

I'm ok developing some quick test utility (C#,C++,scripting etc) as well.

Edit:

  1. As we are using same login - users are not logging out, they just disconnect or lock the terminal.
share|improve this question
1  
I would like to find out how to do exactly the same thing but in Win7 environment. –  Darius Jul 21 '11 at 20:11
    
@Darius, just found the solution to this. Haven't tested it on W7 but hope this works for you as well. –  YetAnotherUser Jul 21 '11 at 21:23
    
@Darius & YetAnotherUser : I answered below: superuser.com/a/822743/430 –  Kevin Worthington Oct 8 at 20:13

4 Answers 4

up vote 15 down vote accepted

We can use qwinsta to Query WINdows STAtion and get a list of all active sessions.

State column shows if a user is active or not. This do require admin access on the target machine.

Got it on TechTalkz: How to View / Disconnect Remote Desktop Sessions from Commandline

enter image description here

share|improve this answer
1  
+1 That's handy. I've been trying to figure out what I have used in the past, but I could not figure it out. I think it may have been psexec \\COMPUTERNAME net session. You can also use tsdiscon to disconnect. –  paradroid Jul 21 '11 at 21:53

Create a BAT file the generates a file on a share saying the computer is in use. When a user logs in, it runs and creates that file. When a user logs out (can be done by GP script), it deletes the file. Check the share for that file before connecting

share|improve this answer
    
I'm sorry I should have mentioned that - As we are using same login - users are not logging out, they just disconnect or lock the terminal. –  YetAnotherUser Jul 21 '11 at 18:32

You could use the NET SEND command to send a message to the machine to see if anyone's on it. This can be made easier by using a GUI app - the link below is the first free one I found by doing a Web search so it comes without any specific endorsement.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_send.mspx

http://www.fomine.com/netsend.html

share|improve this answer
    
+1 - Net Send is a good option. It does requires other user to respond to confirm s/he is using the machine, and one would unnecessarily have to wait 4-5 mins before assuming it's not being used. More over it requires Messenger service to be running on all systems, which is not true in our case. –  YetAnotherUser Jul 21 '11 at 20:08

Another way:

wmic.exe /node:<computername or IP address> computersystem get username

(tested on Windows 7)

share|improve this answer
    
Out of curiosity, why when I try this I get "Access denied" error message? –  Darius Oct 8 at 21:51
    
You may not have administrator privileges on the remote computer. –  Kevin Worthington Oct 9 at 2:12
    
I"m a net admin, I think I should but you pointed me into the right direction.... –  Darius Oct 9 at 5:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.