I am trying to create a batch file that will search through a list of servers provided in a text file, look for my sessions and output to a text file. A plus would be for it to actually log me off of any servers where I have a session.
Here are my attempts.
echo Finding My Sessions
echo === %date% at %time% ===>>"FMS report for %1.log"
for /f %%i in (Servers.txt) do qwinsta %1 /server:%%i >>"FMS report for %1.log"
Would have been good, but qwinsta does not provide the server name.
echo Finding My Logins
echo === %date% at %time% ===>>"FML.log"
for /f %%i in (Servers-all.txt) do psloggedon -l \\%%i >>FML.log
This kind of works, but requires me to search the output and manually log myself off of the servers.
I would prefer this work without the use of any scripting languages.