Kumar
Kumar

Reputation: 141

MSI installation quietly with default values

I am writing a powershell script to uninstall and install a product. Uninstallation and installation process is just clicking on several next buttons with default values populated.

Could you please suggest how to install the MSI file without prompting user for clicking on several next buttons and complete the installation process very quietly.

If I wanted provide customized values during the installation, what could be the process to find out the property names and how to run it silently. Please refer to any references to explore further.

I am using powershell 2.0 and please let me know if further information is needed. Thanks in advance.

Regards, Kumar

Upvotes: 6

Views: 12797

Answers (3)

Stein Åsmul
Stein Åsmul

Reputation: 42126

The basic command line for running silently is (paths truncated):

msiexec.exe /I "C:\WiX.msi" /QN /L*V "C:\msilog.log" MYPROPERTY=1

You can also apply a transform (see explanation below):

msiexec.exe /I "C:\WiX.msi" /QN /L*V "C:\msilog.log" TRANSFORMS="C:\Wix.mst"
  • /QN: run silently, no GUI during or after the install
  • /L*V: write verbose log file with all information
  • MYPROPERTY: set a property at the command line. You can set multiple.

  • The way an MSI file is supposed to be modified for corporate use is to use a transform file (*.mst).

    • This is a little "database snippet" that can change the MSI file (which is a database) once applied to it during runtime.
    • A transform can literally change anything in the MSI, but most often it is used to adjust small things such as removing shortcuts, eliminating undesired runtimes, etc...
    • A transform is applied to an MSI on the msiexec.exe command line by adding the keyword TRANSFORMS followed by the path to the *.mst file.

You can also uninstall MSI files in a variety of other ways (besides the msiexec.exe command line). Here is a rough guide for how to uninstall MSI files. It includes information on how to uninstall with PowerShell, WMI, VBScript Automation, etc... And there is another post on serverfault.com on the issue of avoiding the use of msiexec.exe to prevent unwanted dialog boxes from popping up during automated runs.

Upvotes: 2

PhilDW
PhilDW

Reputation: 20780

You can do this only if the MSI helps you :). For example, if a property called SERVERNAME is set to FRED in a dialog, then you could say SERVERNAME=FRED on the command line. This assumes that the InstallExecuteSequence that does the work of the install uses just the value FRED. Problems occur when the UI sequence does extra things that won't happen in silent mode because the UI sequence doesn't run in a silent install. If the UI sequence dialogs change SERVERNAME by (for example) adding \ to the front and \MyShare at the end and \FRED\MyShare is used in the execute sequence then you need to know set the command line to SERVERNAME="\FRED\MyShare" because that's what the execute sequence expects. If you don't know all the potential relevant property values you could run the install in UI mode with a verbose log and see them. So in the absence of documentation for silent install you need to reverse engineer it a bit.

If you want to specify what features are to be installed then use ADDLOCAL=comma separated list of feature names.

Upvotes: 0

camerondm9
camerondm9

Reputation: 1055

To install a .msi file silently, you should be able to use the /quiet switch with msiexec. If you need to customize anything, you can set property values like this: PROPERTY=Value

Altogether: msiexec /i C:\Path\To\File.msi /quiet PROPERTY=Value

To see all the options, just run msiexec without any parameters. This question is also very similar to yours.

Upvotes: 5

Related Questions