Msiexec.exe: Understanding and Using the Installer Tool

msiexec.exe is a command-line tool used for managing Microsoft Windows Installer packages (.msi files). This tool can perform various operations such as installing, uninstalling, and repairing software. Below are detailed instructions and examples on how to use the msiexec.exe command.

Basic Usage

Installation

To install an .msi file, you can use the msiexec command with the /i parameter:

msiexec /i package.msi

Example:

msiexec /i example.msi

Uninstallation

To uninstall an installed program, you can use the msiexec command with the /x parameter:

msiexec /x {ProductCode}

Example:

msiexec /x {12345678-1234-1234-1234-123456789012}

You can find the product code by using the registry or system auditing tools.

Repair

To repair an .msi installation, you can use the msiexec command with the /f parameter:

msiexec /f package.msi

Example:

msiexec /f example.msi

Parameters

Here are some important parameters you can use with the msiexec command:

  • /i: Install.

  • /x: Uninstall.

  • /f: Repair.

  • /qn: Quiet installation (no user interface).

  • /qb: Basic user interface installation.

  • /l*v log_file: Generate a detailed log file.

Quiet Installation

To install an .msi file quietly (without a user interface):

msiexec /i package.msi /qn

Example:

msiexec /i example.msi /qn

Generating a Log File

To generate a log file during the installation process:

msiexec /i package.msi /l*v log.txt

Example:

msiexec /i example.msi /l*v install_log.txt

Customized Installation

Some MSI files allow for the selection of specific features or settings. You can specify these features using the PROPERTY=VALUE format:

msiexec /i package.msi PROPERTY1=VALUE1 PROPERTY2=VALUE2

Example:

msiexec /i example.msi INSTALLDIR="C:\Program Files\Example" ADDLOCAL=Feature1,Feature2

Examples

Basic Installation

msiexec /i example.msi

Quiet Installation

msiexec /i example.msi /qn

Uninstallation

msiexec /x {12345678-1234-1234-1234-123456789012}

Installation with Log File

msiexec /i example.msi /l*v install_log.txt

Customized Quiet Installation

msiexec /i example.msi INSTALLDIR="C:\Program Files\Example" ADDLOCAL=Feature1,Feature2 /qn

Conclusion

msiexec.exe is a powerful tool for software deployment and management in a Windows environment. The examples and parameters above show how the msiexec command can be used in various scenarios. For more information, you can refer to the official Microsoft documentation.

Last updated