64

Right now I use a powershell script to see the currently logged in users. But I don't see if their session is idle, active or inactive. I can see when the session was started, that's it. Is there an easy way to see how many users are currently logged in to the server I am logged in and see their status? It should not be remotely executed. I would like to avoid third party tools if possible.

RayofCommand
  • 1,451
  • 8
  • 26
  • 36

7 Answers7

77

Use the query user command

Query User Command
http://technet.microsoft.com/en-us/library/bb490801.aspx

Greg Askew
  • 34,339
  • 3
  • 52
  • 81
  • Does anyone know what API calls provide this information? – NetMage Sep 11 '17 at 20:34
  • @NetMage I was just looking for that API myself. Not sure, but maybe check [**NetWkstaUserEnum**](https://msdn.microsoft.com/en-us/library/windows/desktop/aa370669%28v=vs.85%29.aspx). – Stein Åsmul Apr 08 '18 at 20:37
  • It looks like the [**LsaEnumerateLogonSessions**](https://msdn.microsoft.com/en-us/library/windows/desktop/aa378275(v=vs.85).aspx) function is better as described on [CodeProject - Enumerating Logon Sessions](https://www.codeproject.com/Articles/7483/Enumerating-Logon-Sessions) (there is ancient source code to download). – Stein Åsmul Apr 09 '18 at 01:42
49

Open the Task-Manager and see the users tab. There you will find a list of users and their status.

Task-Manager

Daniel
  • 6,780
  • 5
  • 31
  • 60
5

"quser" command will give you the active now users

the same result will give you the "qwinsta" command

Hristo Maznev
  • 51
  • 1
  • 2
4
Get-WMIObject -class Win32_ComputerSystem -ComputerName 192.168.1.9 | Select-Object UserName

where 192.168.1.9 is the IP of the server

3

Use quser or query user to check users connected

quser

query user

quser or query user

Use qwinsta or query session to check sessions connected

qwinsta

query session

enter image description here

JorgeM
  • 231
  • 2
  • 6
1

Its easy in Server 2016 when you are in a session:

Click the search glass bottom left on task bar

Type gateway in the box and this should bring up "Remote Desktop Gateway Manager"; select it.

Click on the ">" next to the RDS server you want to view (RDS-01) for most I guess, then select the monitoring folder

You can now see who is logged on, how long for, since what time and can disconnect them or set connection limits.

Please note you probably need certain admin rights to do this, but it works for me.

Lee Hart
  • 11
  • 1
1

Also you can use the "UserLock" application to see which users logged in. By this 3rd party tool you can manage the session of the users as well as remote desktop sessions. It is a great tool in this case. I suggest you try this tool.

fedora
  • 11
  • 5