Is there a quick and easy way to see users' session idle time on an RDP server?
Thanks
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.
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.
query user
and quser
have the same output on my Windows Server 2012 R2
in command prompt (CMD) just type:
query user
Then it will show you the result.
query user
" 'query' is not recognized as an internal or external command, operable program or batch file."
query user
and quser
have the same output on my Windows Server 2012 R2
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
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.
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()
.
Apr 18, 2019 at 14:04