Use "Query Session" Command

Q

How to use "query Session" to find out how many desktop sessions are running on my Windows 7 computer?

✍: FYIcenter.com

A

If you allow remote logins to your Windows 7 computer, there might be multiple desktop sessions are running on your computer.

To find out how many desktop sessions are on your computer, you can use the "query session" command:

C:\fyicenter>query session /?
Display information about Remote Desktop Sessions.

QUERY SESSION [sessionname | username | sessionid]
              [/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER] [/VM]

  sessionname         Identifies the session named sessionname.
  username            Identifies the session with user username.
  sessionid           Identifies the session with ID sessionid.
  /SERVER:servername  The server to be queried (default is current).
  /MODE               Display current line settings.
  /FLOW               Display current flow control settings.
  /CONNECT            Display current connect settings.
  /COUNTER            Display current Remote Desktop Services counters information.
  /VM                 Display information about sessions within virtual machines.

For example:

C:\fyicenter>query session

 SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
 services                                    0  Disc
 console                                     1  Conn
                   joe_tester                2  Disc
                   jay_writer                3  Disc
>rdp-tcp#0         fyicenter                 5  Active  rdpwd
 rdp-tcp                                 65536  Listen

So there are 6 sessions on this computer:

  • "services - " - Represents the virtual desktop for background services.
  • "console - " - Represents the screen that is attached to the computer. No body is using it at this moment.
  • " - joe_tester" - Represents the remote desktop created to support the remote login for joe_tester.
  • " - jay_writer" - Represents the remote desktop created to support the remote login for jay_writer.
  • "rdp-tcp#0 - fyicenter" - Represents the remote desktop created to support the remote login for fyicenter.
  • "rdp-tcp - " - Represents the virtual desktop used by the rdp-tcp server listening for any new remote login requests.

 

Disconnect User Session with "tsdiscon" Command

Use "Query User" Command

Managing User Remote Login Sessions

⇑⇑ Windows 7 Security Tutorials

2018-01-13, 8618🔥, 0💬