48

How can I view, who is currently connected to a server (Windows 2012) with a remote desktop client? I am myself connected to this server via RDP.

This question offers a solution to get IP addresses with established connections. I would be interested in a list of users or their sessions and when these sessions were active the last time.

6 Answers 6

59

You can type "Query User" into a command prompt on the remote machine to get a very quick look

2
  • 1
    I'm accepting this solution, as it shows the logon and idle times directly. This is exactly what I had hoped.
    – gpinkas
    Feb 22, 2016 at 14:15
  • 10
    You can shorten this to quser.
    – Neil
    Feb 22, 2016 at 17:54
39

Run the "qwinsta" command on the server, or with the /server:servername switch.

>qwinsta /?
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 informati
on.
  /VM                 Display information about sessions within virtual machines
.

You can also reset an RDP session with the "rwinsta" command:

>rwinsta /?
Reset the session subsytem hardware and software to known initial values.

RESET SESSION {sessionname | sessionid} [/SERVER:servername] [/V]

  sessionname         Identifies the session with name sessionname.
  sessionid           Identifies the session with ID sessionid.
  /SERVER:servername  The server containing the session (default is current).
  /V                  Display additional information.
1
  • Ooh - I can't believe I've never seen this one
    – Dan
    Feb 22, 2016 at 13:57
25

You can see in the Task manager users Tab

2
  • 2
    Ah, I was fearing it could be so easy I have it overlooked
    – gpinkas
    Feb 22, 2016 at 13:56
  • Thank you, I love this option! Sep 3, 2021 at 10:19
3

the tsadmin.msc command will give you a nice GUI with information and control over windows RDP sessions

1
  • 4
    tsadmin.msc has been removed by default from Windows 10 (and likely Windows 8.1), as well as Server 2012 R2 and most likely Server 2016. It's possible to restore it to Server 2012 R2 (and probably the other OSes mentioned) by copying the relevant files and registry keys for it from a Server 2008 R2 install. The list of files and keys is on this page: Add TSADMIN.msc back to Windows Server 2012 R2 Jun 29, 2017 at 18:12
3

First option — use command line to query user /server:SERVERNAME (or quser.exe - same thing). This shows User name, Session name, Session Id, Session state, Idle Time and Logon Time for all logged in users.

Second option — use command line to query session /server:SERVERNAME. This shows User name, Session name, Session ID and Session state. It shows all sessions, including disconnected ones, which might be useful.

Third option — install Microsoft Remote Desktop Connection Manager, configure your server(s), then right-click on the server to "list sessions". This shows Session ID, Session state, User domain/name, client machine name. Note that quser and qsession don't show client machine name, which might be useful to identify who is actually using the machine. RDCM doesn't show idle/logon time though, and it's quite outdated and glitchy.

Also important to note that all methods will fail to show active sessions if current user does not have admin rights on the queried remote server. So use runas /u:DOMAIN\adminUser cmd.exe to start admin console first.

0

https://pixelrobots.co.uk/2016/06/add-tsadmin-msc-back-to-windows/

If you can get those files, you can add tsadmin.msc back to Windows 10.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.