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