112

I have a MSI package that I need to install if the package is not already installed. Also I need to install it silently. The package prompts user for:

  • Installation location (C:\Program Files\Foobar)
  • Install type: minimal and full (minimal)

I need to override these two parameters using command line parameters or some other method. So how do I go about these two issues. I'll use VBScript for scripting.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Salman A
  • 262,204
  • 82
  • 430
  • 521

2 Answers2

160

You should be able to use the /quiet or /qn options with msiexec to perform a silent install.

MSI packages export public properties, which you can set with the PROPERTY=value syntax on the end of the msiexec parameters.

For example, this command installs a package with no UI and no reboot, with a log and two properties:

msiexec /i c:\path\to\package.msi /quiet /qn /norestart /log c:\path\to\install.log PROPERTY1=value1 PROPERTY2=value2

You can read the options for msiexec by just running it with no options from Start -> Run.

Polynomial
  • 27,674
  • 12
  • 80
  • 107
  • 9
    Is there a way to find a list of acceptable parameters (`PROPERTY1` and `PROPERTY2` in your example)? – Salman A Dec 19 '11 at 11:07
  • Here is the predefined properties list: http://msdn.microsoft.com/en-us/library/windows/desktop/aa370905(v=VS.85).aspx The installation folder property is different for each setup authoring tool. What did you use to create the MSI? – Cosmin Dec 19 '11 at 13:17
  • @Cosmin: MSI consists of runtime DLLs of a payment system (not created by me). I am looking at a tool called Ocra to dissect the MSI, it gave me a hint about a variable called "INSTALLLOCATION". I am checking. – Salman A Dec 19 '11 at 13:30
  • Then INSTALLLOCATION is most likely the installer property associated with the main installation folder. Try setting it through msiexec command line. – Cosmin Dec 19 '11 at 13:51
  • @SalmanA - Ocra is a great tool. It should be able to dissect all the custom UI elements. If I remember correctly, all custom UI input elements in MSI packages have a variable attached to them which is exported, so you can access the value via the command line. – Polynomial Dec 19 '11 at 17:52
  • (i) I wasn't able to check whether the package was already installed so I used another trick (ii) I managed to explicitly specify the install location via the `INSTALLLOCATION` parameter. – Salman A Dec 20 '11 at 06:00
  • 9
    Note: msiexec seemed to be pretty picky about specifying the FULL file path to the MSI package. Don't try any of this `.\mypackage.msi` business. Took me a little bit to figure that out. – Phil Nov 01 '13 at 14:35
  • 5
    The name of the MS product is actually Orca, not ocra. Might be hard to google with the misspelling. You might get a lot of Creole recipes... but not MSI builders. http://msdn.microsoft.com/en-us/library/aa370557(v=vs.85).aspx – Scott Lundberg Jun 18 '14 at 16:09
23

The proper way to install an MSI silently is via the msiexec.exe command line as follows:

msiexec.exe /i c:\setup.msi /QN /L*V "C:\Temp\msilog.log"

Quick explanation:

 /L*V "C:\Temp\msilog.log"= verbose logging
 /QN = run completely silently
 /i = run install sequence 

There is a much more comprehensive answer here: Batch script to install MSI. This answer provides details on the msiexec.exe command line options and a description of how to find the "public properties" that you can set on the command line at install time. These properties are generally different for each MSI.


Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164