3

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.

stead1984
  • 577
  • 8
  • 16
  • 32

4 Answers4

6

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"
)
aphoria
  • 314
  • 4
  • 7
  • It doesn't seem to work, I've made the amendments required. I don't get an error message, all the machines are on and on the network. – stead1984 Jun 16 '11 at 07:31
  • @stead1984 There was a typo in the code. I changed `\\%%1` to `\\%%i`. Try that and see what happens. – aphoria Jun 16 '11 at 11:32
  • At my previous job I did it this way, for MSI installation and otherwise, for years to do almost everything. I love PsExec. My favorite tool OF ALL TIME on Winboxen! – songei2f Jun 16 '11 at 13:22
  • @aphonia I've made the changes as said but still nothing. It does look like it runs. – stead1984 Jun 16 '11 at 13:47
  • @stead1984 Try using `notepad.exe` or `calc.exe` as the program to run...that will make it easier to determine where the problem is. – aphoria Jun 16 '11 at 14:39
  • @aphonia Thanks for your help, do I need the brackets? – stead1984 Jun 16 '11 at 15:02
  • @stead1984 Do you mean the `()` after `DO` or the `""` around the program to run? – aphoria Jun 16 '11 at 15:08
  • @aphonia That works a treat but I've noticed it won't execute the next computer until the opened calculator window is closed by the end user. I'm really greatful for your help by the way. – stead1984 Jun 16 '11 at 15:10
  • @stead1984 You are welcome...glad to help. `PSEXEC` has a `-d` parameter which means "don't wait for the process to terminate." – aphoria Jun 16 '11 at 15:15
  • @aphoria I've spelt your name correctly now lol. That has worked a treat thanks very much. – stead1984 Jun 17 '11 at 07:22
  • @stead1984 lol...I noticed the misspellings, but it was close enough I knew who you were talking to. :) – aphoria Jun 17 '11 at 12:16
2

I created a VB app that I think fits what you're looking for. The application is called Script Zombie. Basically it passes a host name to script to be executed. You can control how many tasks will be spawned concurrently, so you could have your script running against as many as 25 systems at once.

Here's where you can grab the free application: Script Zombie v0.85

1

if you have admin on the remote devices doesn't psexec have an command line option that uses a text file for input!

tony roth
  • 3,844
  • 17
  • 14
  • That would be great if I didn't need to specify a local admin password, as none of our domain user accounts have local admin rights. – stead1984 Jun 15 '11 at 12:16
0

As you are able to use startup scripts perhaps you can script this so that each machine initiates it from that end, rather than trying to push it out from remote. If necessary the script could start by checking a file on a shared resource which lists the machines that should be involved and exit if it's name is not on the list.

John Gardeniers
  • 27,262
  • 12
  • 53
  • 108