query session
Displays information about sessions on a Remote Desktop Session Host server. Windows commands reference
On Windows
Windows
Displays information about sessions on a Remote Desktop Session Host server. The list includes information not only about active sessions but also about other sessions that the server runs. NOTE: To find out what's new in the latest version, see What's New in Remote Desktop Services in Windows Server.
query session [<sessionname> | <username> | <sessionID>] [/server:<servername>] [/mode] [/flow] [/connect] [/counter]C:>query sessionSESSIONNAME USERNAME ID STATE TYPE DEVICEconsole Administrator1 0 active wdcon>rdp-tcp#1 User1 1 active wdtsharerdp-tcp 2 listen wdtshare4 idle5 idlequery session /server:Server2query session modeM02
<sessionname>Specifies the name of the session that you want to query.<username>Specifies the name of the user whose sessions you want to query.<sessionID>Specifies the ID of the session that you want to query./server:<servername>Identifies the rd Session Host server to query. The default is the current server./modeDisplays current line settings./flowDisplays current flow-control settings./connectDisplays current connect settings./counterDisplays current counters information, including the total number of sessions created, disconnected, and reconnected./?Displays help at the command prompt.