query user
Displays information about user sessions on a Remote Desktop Session Host server. Windows commands reference
On Windows
Windows
Displays information about user sessions on a Remote Desktop Session Host server. You can use this command to find out if a specific user is logged on to a specific Remote Desktop Session Host server. This command returns the following information: - Name of the user - Name of the session on the Remote Desktop Session Host server - Session ID - State of the session (active or disconnected) - Idle time (the number of minutes since the last keystroke or mouse movement at the session) - Date and time the user logged on NOTE: To find out what's new in the latest version, see What's New in Remote Desktop Services in Windows Server.
query user [<username> | <sessionname> | <sessionID>] [/server:<servername>]query userquery user USER1 /server:Server1
<username>Specifies the logon name of the user that you want to query.<sessionname>Specifies the name of the session that you want to query.<sessionID>Specifies the ID of the session that you want to query./server:<servername>Specifies the Remote Desktop Session Host server that you want to query. Otherwise, the current Remote Desktop Session Host server is used. This parameter is only required if you're using this command from a remote server./?Displays help at the command prompt.