Need to script the installation of some MSIs and a few registry edits

1

I'm periodically required to update a whole bunch of browser plugins and other programs. I figured I might as well automate the process with a batch script. I found the MSI's for Reader, Java, Flash, Chrome, Firefox, et al. (just finding the MSI's took some doing). I'm a total novice when it comes to MSI installations.

From what I've found, I should just be able to do it like this:

msiexec /i \\server\directory\FlashFF.msi /qn /norestart
msiexec /i \\server\directory\FlashIE.msi /qn /norestart
msiexec /i \\server\directory\Java.msi /qn /norestart
msiexec /i \\server\directory\Reader.msi /qn /norestart

But that hasn't been working for me. Apparently the MSI system's not as obvious as apt-get or other tools I'm familiar with. How do I script these installs?

Additionally, I also found that I can make a few registry edits to tell the updater services for Reader and Java to shut up. Our students don't have admin rights so these updater services do nothing but cause trouble. Can I script these edits as well? If so, how?

user2793302

Posted 2013-09-18T22:29:49.903

Reputation: 13

Do you have a Windows domain? You should be using group policies to install stuff. If you have many computers you should also be strongly looking at paying for and using Ninite Pro or a similar tool. Using something like Ninite will make your life far easier.

– Zoredache – 2013-09-18T23:38:59.067

@Zoredache that's a pretty broad statement that can just as easily be false depending on the size of the organization, and the structure of its OUs... – Austin T French – 2013-09-19T00:31:47.547

Why is it not working? Errors or something else happening? – Austin T French – 2013-09-19T00:32:19.877

Answers

0

Try appending each with Call and wait commands. MSIEXEC will generally exit straight to the console, which causes additional msiexecs to fail as something is already seen installing:

"start /wait msiexec /i \\server\directory\FlashFF.msi /qn /norestart"

For the registry updates, there are two ways to do this:

  1. Export the registry keys, then call them from the batch script
  2. Use Reg Add, you can call the help system with reg add /? to get the syntax:

REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f]

KeyName [\Machine]FullKey Machine Name of remote machine - omitting defaults to the current machine. Only HKLM and HKU are available on remote machines. FullKey ROOTKEY\SubKey ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ] SubKey The full name of a registry key under the selected ROOTKEY.

/v The value name, under the selected Key, to add.

/ve adds an empty value name (Default) for the key.

/t RegKey data types [ REG_SZ | REG_MULTI_SZ | REG_EXPAND_SZ | REG_DWORD | REG_QWORD | REG_BINARY | REG_NONE ] If omitted, REG_SZ is assumed.

/s Specify one character that you use as the separator in your data string for REG_MULTI_SZ. If omitted, use "\0" as the separator.

/d The data to assign to the registry ValueName being added.

/f Force overwriting the existing registry entry without prompt.

Examples:

REG ADD \ABC\HKLM\Software\MyCo Adds a key HKLM\Software\MyCo on remote machine ABC

REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead Adds a value (name: Data, type: REG_BINARY, data: fe340ead)

REG ADD HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail Adds a value (name: MRU, type: REG_MULTI_SZ, data: fax\0mail\0\0)

REG ADD HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d ^%systemroot^% Adds a value (name: Path, type: REG_EXPAND_SZ, data: %systemroot%) Notice: Use the caret symbol ( ^ ) inside the expand string

Austin T French

Posted 2013-09-18T22:29:49.903

Reputation: 9 766

No luck. I still can't get it to work. Now my scripts look like:

start /wait msiexec /i \\sabercat\frhmain\frhstaff\kristopw\MSIs\FlashFF.msi /qn /norestart


start /wait msiexec /i \\\Directory\MSIs\FlashIE.msi /qn /norestart


But I still can't get anything to install. – user2793302 – 2013-09-19T16:43:53.210

Hmm, I think part of the problem is the installers refuse to overwrite the old copies of the programs. How do I either tell them to overwrite the old version or can I have the script uninstall the old browser and plugin first? – user2793302 – 2013-09-20T17:49:04.087

I got it working. We do indeed have active directory. It's just the people in charge of pushing out updates aren't always all that quick to respond. They've got a lot of other things on their plate but some sites don't work with older plugins or nag our users incessantly.

The reason it wasn't working was due to a few quirks in our setup. I get the sense our AV software doesn't like silent installs via batch script so running MSIs in passive mode fixes that. Also, network location seems to be better on our network than network drives. Thanks guys. – user2793302 – 2013-09-23T22:21:53.247