How do I automate an MSI installs?

Posted on


I have about 20 applications that need to be run in a specific order. I want to script them so that I can do this remotely.

Each one of the applications has a Setup.exe and an MSI.

I was hoping just to have a simple script that called the MSIs with an answer file, but it has been years since I have done it. However, I do not remember how to create an answer file.

Is this a good way to do it? Or would there be a simpler way?


Talk about a loaded question…

For starters, ignore the setup.exe. Odds are it just calls the MSI. Or sometimes they extract a bunch of stuff THEN call the MSI, you can usually watch your temp directory when you run setup and get an idea of what its doing.

I always cheated and did a dry run of the install (msiexec /i path/to-install.msi /l*v /qn) with logging cranked up, then went through the log and picked out the properties I wanted to set and set them via the command line. Answer files never worked, or weren’t worth the trouble of going through the process to make them.

Then I found InstEdit and used it a boatload. It will let you edit properties of an MSI and generate a Transform you can then pass in as an argument in your script: msiexec /i path/to/installer.msi /t path/to/transform.mst I recommend giving it a shot first, there’s a free version that does just about everything.

You might also take a look here for all the switches msiexec has.

Msiexec is the tool you need. It has a -q parameter to let it install stuff “quiet”:

/qn : Displays no user interface.

/qb : Displays a basic user

/qr : Displays a reduced user
interface with a modal dialog box
displayed at the end of the

/qf : Displays the full user
interface with a modal dialog box
displayed at the end.

/qn+ : Displays no user interface,
except for a modal dialog box
displayed at the end.

/qb+ : Displays a basic user
interface with a modal dialog box
displayed at the end.

/qb- : Displays a basic user
interface with no modal dialog boxes.

You can also provide named options (or “properties”) at the end of the command line; which properties are supported depends on the package. For example, this command:

msiexec /qb /l* perl-log.txt /i ActivePerl.msi PERL_PATH=Yes PERL_EXT=Yes

…is how you install ActiveState Perl, instructing the MSI package to add Perl.exe to your PATH and to associate .pl files with it. (source)

Most applications can be installed silently and therefor scripted. Each Setup.exe can have a number of potential switches, so calling the vendor or searching their web site is a must. Sometimes you can get the info by starting setup with a /?, /h /help switch. MSI files can also have any number of switches but this article MSI command line parameters provides a list.

When scripting the process you may run into an app that installs with setup.exe and then launches another file like an MSI. One example was MS Office XP. When this occurs your script may think that the file you launched is complete and start the next setup which fails causing everything to go south. To get around this try bypassing the setup file and go straight to the actual installer (potentially an MSI) with command line options. If that is not possible you may need to create some sort of timer pause. I used to use a little utility called wait.exe that I found on the internet but there are a million ways to do this. The key to the scripting though is to be able to identify that an application installed correctly so that the next installation can begin.

Leave a Reply

Your email address will not be published.