Thursday, June 13, 2013

Run installations/apps remotely using Batch File


Today I had to install an app on multiple machines. So I used the below batch statement to copy and install the application to all machines without logging in to each box.

To use the below batch file you need psexec executable which can be downloaded from http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

So how do you install apps on multiple machines without logging into each box?

1) Create test_copy.bat file with below statements. Replace [MSIFILE] with the installation file name

echo off
set arg1= %arg1%
xcopy /r /y "[MSIFILE].msi" \\"%arg1%"\e$\
psexec \\%arg1% cmd.exe /c msiexec /i e:\[MSIFILE].msi /L*v install.log /qn
del \\"%arg1%"\e$\[MSIFILE].msi
echo

2) Run "test_copy.bat" file from cmd line by specifying the machine name like "test_copy.bat -[machinename]"

That's it. You may have to provide additional parameters to "msiexec" statements to provide default installation directory etc. Also the windows user should have admin privilege on the installation box.

You can even run remote applications this way.


No comments: