5

Is there a quick and easy way to see users' session idle time on an RDP server?

Thanks

5 Answers 5

3

Terminal Services Manager can get you this information.

Under administrative tools -> Terminal Services -> Terminal Services Manager

Then select the host in the left pane and in the middle pane select the "Sessions" tab. There will be a listing of all active sessions and there is an "IdleTime" column.

The output is intererpeted as "Days+Hours:minutes". So for example, if the output is "4+11:23" the user has been idle for 4 days, 11 hours, and 23 minutes.

It's also worth noting that you can log these sessions off by right clicking and disconnecting them. Though it might be nice to pay them a phone call first :P

Edit: Well that's a good answer for versions of Server prior to 2012 :( But since they eliminated Terminal Services Manager from newer versions of Server, it seems like this powershell script might be the best option: https://gallery.technet.microsoft.com/scriptcenter/Get-LoggedOnUser-Gathers-7cbe93ea

I assume that the IdleTime is being reported in minutes, since my initial tests only display single integers.

3
  • I like your thinking, and I really miss Terminal Services Manager, but as far as I know, the tool no longer exists :(This is Server 2012 R2) Feb 18, 2016 at 22:00
  • 2
    This is still possible in Server 2012 R2. Server Manager --> Remote Desktop Services --> Collections (RDS hosts need to be in the pool). Review connections in the bottom right panel. Time seems to be hours : minutes : seconds Oct 12, 2017 at 22:52
  • Oh good to know!
    – p_q
    Oct 18, 2017 at 22:41
9

Since Windows 2008 the command quser works.

Displays information about user sessions on a Remote Desktop Session Host (RD Session Host) server.

In fact, the PowerShell script linked to in answer simply runs this command. OP asked for a quick and easy way, this is definitively quicker than to download and execute PS-script.

Example from Windows Server 2012 R2:

C:\Users\admin.tedd>quser
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
 admin.xxxxxxxx                            2  Disc     15+15:12  7/20/2017 1:19 PM
 admin.xxxxx           rdp-tcp#54          3  Active       1:39  7/21/2017 5:35 AM
 xxxxxxxx                                  4  Disc      6+04:10  7/21/2017 9:25 AM
>admin.tedd            rdp-tcp#86          5  Active          .  8/9/2017 4:40 PM

Number in front of + is days, so 15+15:12 is 15 days, 15 hours and 12 minutes.

Note! Documentation says this is the same as running query user. The command query does not exist on my servers. Not sure if this is separate install or part of a feature install.

1
  • query user and quser have the same output on my Windows Server 2012 R2
    – Sinky
    Nov 21, 2018 at 12:46
0

in command prompt (CMD) just type:

query user

Then it will show you the result.

3
  • query user " 'query' is not recognized as an internal or external command, operable program or batch file."
    – DavidPostill
    Sep 22, 2016 at 20:50
  • 2
    "query user" worked for me in powershell window on the server (Windows 2012 R2)
    – rob
    Oct 2, 2017 at 13:51
  • query user and quser have the same output on my Windows Server 2012 R2
    – Sinky
    Nov 21, 2018 at 12:46
-1

You can use powershell to locate various users or multiple server's idle time The script was created by user "Cookie.Monster" on technet Get-UserSession - Parse query user result

More detail of the script, and usage can be found in the link above

-1
Get-RDUserSession |ft Username,Idletime
Get-RDUserSession |select-object UserName,Servername,IdleTime,CreateTime

Just a few examples – the BIG issue is converting the "idletime property" which is some integer of time Example: 6667354 converted to Days:HH:MM:SS

I have not figured that out yet.

2
  • 1
    Where? (Power)shell?
    – bertieb
    Mar 8, 2017 at 20:39
  • 1
    If someone else would be interested, the IdleTime property returned by Get-RDUserSession command is in milliseconds and you can convert it to a more readable format using the function [TimeSpan]::FromMilliseconds().
    – vladimirm
    Apr 18, 2019 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .