For Loop command to list users with sessions on servers

For Loop command to list users with sessions on servers

Problem :  Users/Admins disconnect from sessions on servers. How to get a list of users logged on to server active and disconnected

Simple Solution!

Create a file call servers.txt   – save in c:\temp

(possibly dsquery computer -name * >servers.txt    note your will need to delete all detail except server name)

Create a batch file call : listloggedinUsers.bat   – save in c:\temp

In the listloggedinUsers.bat type the following

for /f %%s in (servers.txt) do (echo %%s & qwinsta /server:%%s)

Save the bat file

Load command prompt as administrator.

Type
c:\temp\listloggedinusers.bat >> users_date_time.txt

This out put shows all 3389 connections. ie. RDP sessions

 

Steve

Comments are closed.