46

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.

gpinkas
  • 563
  • 1
  • 5
  • 8

6 Answers6

55

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

Dan
  • 15,280
  • 1
  • 35
  • 67
38

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.
pat o.
  • 1,919
  • 1
  • 16
  • 28
25

You can see in the Task manager users Tab

Jason
  • 251
  • 2
  • 3
3

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

T. Josef
  • 31
  • 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](https://joshheffner.com/add-tsadmin-msc-back-to-windows-server-2012-r2/) – KrazyAssKatzen Jun 29 '17 at 18:12
2

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 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 adming console first.

il--ya
  • 121
  • 2
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.

software is fun
  • 306
  • 2
  • 6
  • 14