Script that shows specific user is logged into a list of servers. The script I have shows all RDC sessions.

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)

{

$server

$command = “quser /server:” + $server

invoke-expression $command

}
Parents Reply
  • im rubbish at scripting - hence on here trying to learn but.....

    using the quser output above you just need the sessionID, and this command:

    logoff 2 /server:servername

    hopefully someone else on here can say how to do it as that would be useful for me too.....if not give me 6 months or so. Slight smile

Children
No Data