Ways to check if user is active on remote machine before RDP'ing
Solution 1:
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
Solution 2:
Similar to the accepted answer you can also use Query.exe
like this:
quser /server:<COMPUTERNAME>
This will result ins the following:
Solution 3:
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
Solution 4:
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