Remote installing programs by scripts or batch files

batch-filemsipstoolsscriptingwindows-installer

Firstly, I can't use Group Policy as our team doesn't manage that. The company is a massive FTSE company with a team for every aspect of IT you can think of.

Our team needs a way of installing programs remotely either by batch files or scripts utlising Windows Installer and .msi files.

I've so far managed to install Java using psexec (see below)

psexec \\pcname -u *username* -p *password* -i 
msiexec.exe /a "msilocation\install.msi"

This works without any problems. However I want something a little more automatic than that.

However what I would like to do is to be able to run a script or batch file from my machine that will install the msi on all remote workstations listed. I'm pretty certain you can list workstations in batch file but I maybe wrong.

I'm not to fussed if I have to do the fix in a script or batch file to be honest. I just can't use Group Policy etc.

Best Answer

Create a text file named COMPUTERS.TXT and put all the computer names in it, one per line.

Then, create a .CMD file with the following code:

EDIT

I added %%i\ in front of *username to specify the remote machine admin user.

EDIT 2

I fixed a typo in the code...changed psexec \\%%1 to psexec \\%%i.

@ECHO OFF

FOR /F "tokens=1" %%i IN (COMPUTERS.TXT) DO (
  psexec \\%%i -u %%i\*username* -p *password* -i msiexec.exe /a "msilocation\install.msi"
)