|

How To Use Msiexec To Install Or Uninstall MSI Files (2026)

The msiexec command installs, repairs and removes Windows Installer (.msi) packages straight from the command line.

Microsoft documents the syntax for Windows 11 and Windows 10, and every option below comes from its pages.

Use it when double-clicking an .msi file fails, when you need a log of a failed install, or when you want a setup with no windows.

Table of Contents

Quick answer: the msiexec commands

TaskCommand (Microsoft’s own examples)
Install a packagemsiexec.exe /i "C:\example.msi"
Install with no windowsmsiexec.exe /i "C:\example.msi" /qn
Install without restartingmsiexec.exe /i "C:\example.msi" /norestart
Install and write a full logmsiexec.exe /i "C:\example.msi" /L*V "C:\package.log"
Uninstall a packagemsiexec /x msisample.msi
Force a repair of every filemsiexec.exe /fa {AAD3D77A-7476-469F-ADF4-04424124E91D}

Replace the path with the real location of your file, and keep the quotation marks if the path contains spaces.

How to install an MSI file

  1. Open Command Prompt.
  2. Type msiexec.exe /i, then a space, then the full path of the .msi file in quotation marks.
  3. Press Enter and follow the installer, or add a display option from the next section to change what you see.

The /i option is the normal installation, and Microsoft’s older reference says it installs or configures a product.

The /a option does something different: it runs an administrative installation, which installs a product on the network.

Display options: control what you see

OptionWhat Microsoft says it does
/quietQuiet mode, with no user interaction required
/passiveUnattended mode that only shows a progress bar
/qnNo interface during the installation
/qn+No interface, except a final dialog box at the end
/qbBasic interface
/qb+Basic interface with a final dialog box
/qrReduced interface
/qfFull interface

Microsoft notes you can add an exclamation mark, as in /qb+!, to hide the Cancel button.

That exclamation mark works only with the basic interface and is not valid with the full interface.

Restart options

If a package changes files that are in use, Microsoft says a restart might be needed before the installation completes.

OptionEffect
/norestartStops the device from restarting after the installation completes
/promptrestartAsks you if a restart is required
/forcerestartRestarts the device after the installation completes

How to uninstall or repair a package

To remove a package, run msiexec /x followed by the .msi file name, as in Microsoft’s example msiexec /x msisample.msi.

Microsoft’s parameter table says /x accepts either the package or a product code.

For a normal program with no .msi file on hand, our guide to uninstalling a program in Windows 11 uses Settings instead.

Repair uses the /f option with a letter, and it needs the package or the product code.

Repair optionReinstalls files when
/fpA file is missing
/foA file is missing or an older version is installed
/feA file is missing or an equal or older version is installed
/fdA file is missing or a different version is installed
/fcA file is missing or the checksum does not match
/faAlways: all files are reinstalled
/fuAll required user-specific registry entries are rewritten
/fmAll required computer-specific registry entries are rewritten
/fsAll existing shortcuts are overwritten

The older Microsoft reference says the default for /f is omus, and it warns not to use the v flag for a first installation.

Write a log file to find out why an install fails

Add /L with a letter and a file path, for example msiexec.exe /i "C:\example.msi" /L*V "C:\package.log".

Microsoft says the folder for the log must already exist, because the installer does not create the directory structure.

Logging optionWhat it records
/liStatus messages
/lwNon-fatal warnings
/leAll error messages
/loOut-of-disk-space messages
/lvVerbose output
/l+Appends to an existing log file
/l*Everything except verbose and extra debugging information

To include the verbose and debugging data as well, Microsoft says to use /l*vx.

Set a public property

Only public properties can be set on the command line, and they go after the package, as in msiexec /i A:\Example.msi PROPERTY=VALUE.

Microsoft marks the reverse order as incorrect, so never place the property between /i and the file.

Property names are read as uppercase, and a value that contains spaces must be in quotation marks.

What the exit codes mean

Msiexec sets an error level that matches a Windows system error code when it finishes.

CodeMicrosoft’s description
0The action completed successfully
1601The Windows Installer service could not be accessed
1602The user canceled the installation
1603A fatal error occurred during installation
1605The action is only valid for products that are currently installed
1612The installation source for the product is not available
1618Another installation is already in progress
1619, 1620The installation package could not be opened
1638Another version of the product is already installed
1639Invalid command line argument
1641The installer initiated a restart, which indicates success
3010A restart is required to finish, which indicates success

Codes 1641 and 3010 are success results, so they do not mean the install failed.

If you see 1618, read our fix for “Another installation is in progress”, and for 1603 on a graphics driver see our AMD Software error 1603 guide.

Rules that prevent a 1639 error

  • Do not combine /i, /x, /f, /j, /a, /p, /y and /z in one command, except /p with /a to patch an administrative image.
  • /l and /q can be combined with /i, /x, /f, /j, /a and /p.
  • Command-line options are not case sensitive.
  • Typing /? or /h shows only copyright information, not a list of options.

To open Command Prompt quickly, see how to open the Run dialog in Windows 11.

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *