The script below lists all users that have open RDC sessions on a list of servers.I need it to just list any from a specific person. Could anyone help...
$servers = get-content “C:\scripts\servers.txt”
foreach ($server in $servers)
$command = “quser /server:” + $server
Should probably take a look at this:
Why re-invent the wheel?
This is helpful, but it doesn't really answer the question.
You could do something like below. The unfortunate thing is that quser doesn't know how to quietly tell you a user in NOT logged on, that is, the error message in PowerShell is pretty ugly.
That does list just the one username, but now it doesn't show the servername. example:
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
cfranks rdp-tcp#0 2 Active 4 7/23/2014 11:30 AM
That's pretty simple. Add this line above the quser line:
"----- $computer -----"
that worked perfectly thanks..
Is there any way to add a Log Off command to this script?
Powered by IDERA