The push package upgrade for Windows can be automated with tools, but if the number of machines is not large, the use of scripts is more efficient and is used here to the PsExec.exe tool.
Structure:
Initserver.bat
Work.bat
PsExec.exe
Files (file to be pushed)
ResSuccess.log(log of successful execution)
ResFaild.log(failed log execution)
Init.bat is the serverPWD.txt inside the target IP and password to Work.bat.
Initserver.bat
echo-----Start at:%data%%time%----->ressuccess.logecho-----Start at:%data%%time%----->resfaild.logfor/f " tokens=1,2 delims=: "%%i in (serverPWD.txt) does (call Work.bat%%i%%j) echo-----End at:%data%%time%-----> Ressuccess.logecho-----End at:%data%%time%----->resfaild.log
The role of Work.bat is to copy the files in file to the target machine and execute the above script.
Work.bat
Set Ip=%1%set pwd=%2%set files=filesnet use \\%ip% "%pwd%"/user: "Administrator" if%errorlevel% EQU 0 (xcopy/s/e/y%fil es% \\%ip%\c$ping 127.0.0.1–n 2start cmd/c PsExec.exe \\%ip%-u administrator–p%pwd%-W C:\client C:\client\run.batnet Use \\%ip%\ipc$/delecho%ip%>> resSuccess.log) Else (echo%ip%>> resFaild.log)
Windows Push Package Script