How to collect the same file from several different servers for comparison or other type of analysis :)

this example is also useful if you want to iterate through comma separated/delimited values stored in a variable in bat script
.bat file contents looks like this 🙂
@echo off

SET servers=server1,server2,

for /D %%f in (%servers%) do (
echo connecting to: %%f
net use \\%%f\c$\windows /delete
net use \\%%f\c$\windows /user:%%f\Administrator qwerty123.
copy \\%%f\c$\windows\log.log "%%f - log.log"
net use \\%%f\c$\windows /delete


Leave a Reply