Silent installation of a MSI package

345,458

Solution 1

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.

Solution 2

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.

Share:
345,458

Related videos on Youtube

Salman A
Author by

Salman A

Updated on February 28, 2020

Comments

  • Salman A
    Salman A about 4 years

    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.

  • Salman A
    Salman A over 12 years
    Is there a way to find a list of acceptable parameters (PROPERTY1 and PROPERTY2 in your example)?
  • rmrrm
    rmrrm over 12 years
    Here is the predefined properties list: msdn.microsoft.com/en-us/library/windows/desktop/… The installation folder property is different for each setup authoring tool. What did you use to create the MSI?
  • Salman A
    Salman A over 12 years
    @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.
  • rmrrm
    rmrrm over 12 years
    Then INSTALLLOCATION is most likely the installer property associated with the main installation folder. Try setting it through msiexec command line.
  • Polynomial
    Polynomial over 12 years
    @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.
  • Salman A
    Salman A over 12 years
    (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.
  • Phil
    Phil over 10 years
    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.
  • Scott Lundberg
    Scott Lundberg almost 10 years
    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. msdn.microsoft.com/en-us/library/aa370557(v=vs.85).aspx
  • phedon rousou
    phedon rousou over 9 years
    How can I do this with an .exe file? I tried converting it to an msi but it is complaining
  • Polynomial
    Polynomial over 9 years
    @phedonrousou It's probably not an MSI package, but rather a different (likely commercial) installer. Please open up a new question if you're having problems.
  • Cartucho
    Cartucho over 4 years
    How can I modify the script to add cmake to windows path?
  • Polynomial
    Polynomial over 4 years
    @Cartucho You should ask a new question for that.