Read list of computers from a text file

May 2, 2010 at 20:16:11
Specs: Windows 7
I've read many post on this forum, but I can't quite find the answer I'm looking for.
I need a batch file that will read a text file containing computer names (one per line), then store that computer name in a variable, then insert that variable into a UNC path, then copy some files to that computer, psexec the copied files, then go to the next computer and do the same thing.

Any ideas?

See More: Read list of computers from a text file

Report •

May 2, 2010 at 21:03:43
Here's a start, (warning, won't work off the bat! pun intended but execrable!):
for /f %%a in (listcmp.txt) do (
echo processing to computer %%a
copy /y u.exe \\%%a
psexec \\%%a\u.exe
::------ end
that is only intended to give you some working material.
Once the errors occur, pls post content of errormsgs and

Report •

May 3, 2010 at 07:44:20
It couldn't be that simple, could it? LOL

I think this is exactly what I'm looking for. I modified the batch to just copy a file to several computers in my "listcmp.txt" and it worked like a champ!!

I'm trying to run "msiexec" (with arguments) from the psexec command and I'm getting errors. I think I'll perform some more testing and post the results later.

Thank you, thank you, thank you!!

Report •

May 4, 2010 at 11:05:10
Ok, here is the finished script (names have been changed....):

for /f %%a in (computers.txt) do (

echo processing computer %%a

copy /y \\SERVER\app.msi \\%%a\c$\app.msi

psexec \\%%a -u DOMAIN\admin -p ???????? msiexec /q /i \\%%a\c$\app.msi DEPLOYID=123456789012345678901234567890

psservice \\%%a -u DOMAIN\admin -p ???????? restart appSERVICE


::------ end

Many thanks to nbrane for a quick response and getting me started in the right direction.

Report •
Related Solutions

Ask Question