4
1
Is there a quick and easy way to see users' session idle time on an RDP server?
Thanks
4
1
Is there a quick and easy way to see users' session idle time on an RDP server?
Thanks
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.
8
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 – Sinky – 2018-11-21T12:46:59.607
-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
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." – DavidPostill – 2016-09-22T20:50:16.987
2"query user" worked for me in powershell window on the server (Windows 2012 R2) – rob – 2017-10-02T13:51:16.960
query user
and quser
have the same output on my Windows Server 2012 R2 – Sinky – 2018-11-21T12:46:01.433
-2
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.
1Where? (Power)shell? – bertieb – 2017-03-08T20:39:13.627
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 – 2019-04-18T14:04:45.877
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) – Bjørn H. Sandvik – 2016-02-18T22:00:17.907
2This 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 – Jake Nelson – 2017-10-12T22:52:00.537
Oh good to know! – p_q – 2017-10-18T22:41:00.967