MSIEXEC - CMD


Overview

MSIEXEC is a command-line utility in Windows that is used to install, modify, and perform operations related to Windows Installer packages (.msi files). It provides administrators and users with the capability to automate the installation of applications and manage the installation settings. MSIEXEC is especially useful for deploying software in silent or unattended modes, making it a crucial tool in system administration, software deployment, and automation tasks.

Syntax

The basic syntax for MSIEXEC is:

msiexec [/i|/a|/u|/f [p]] [/l{*|i|w|e|a|r|u|c|m|o|p|v|x|+|!}] [/p <patch>] [/q{b|r|f|n|b+|b-}] [<Property>=<Value>] <package | /x {GUID}>
  • /i : Installs or configures a product.
  • /a : Administrative install – Installs a product on the network.
  • /u : Uninstalls the product.
  • /f : Repairs a product.

Parameters:

  • <package>: Specifies the Windows Installer package file.
  • {GUID}: Globally Unique Identifier for the product.

Options/Flags

  • /l : Enables logging with various logging levels (*, i, w, e, a, r, u, c, m, o, p, v, x, +, !).
  • /p: Applies a patch.
  • /q: Sets the UI level (b for basic, r for reduced, f for full, n for none).
  • /x: Uninstalls the package.

Examples of Properties:

  • REBOOT=ReallySuppress : Suppresses any attempt to reboot.
  • ADDLOCAL=FeatureName : Installs specific features from the package.

Examples

1. Install a package:

msiexec /i C:\path\to\installer.msi /qn

2. Uninstall a software using its GUID:

msiexec /x {1234-1234-1234-123456789ABC} /qn

3. Apply a patch to an installed application:

msiexec /p C:\path\to\patch.msp /qn

Common Issues

  • Error 1603: A general error that can occur during installation. Make sure the current user has sufficient privileges.
  • Error 1619: This happens when the package could not be opened. Verify that the package exists and is accessible.

Solution:
Run CMD as Administrator or ensure the installer package is not corrupt.

Integration

Script to install multiple applications in sequence:

@echo off
msiexec /i C:\setup\app1.msi /qn
msiexec /i C:\setup\app2.msi /qn
if not %errorlevel%==0 goto errorhandling
echo Installation successful!
exit 0
:errorhandling
echo Failed with error %errorlevel%.
exit %errorlevel%
  • DISM: Deployment Image Servicing and Management, useful for Windows image and recovery.
  • Powershell: Advanced scripting and automation capable of handling .msi installations through various cmdlets.

For more details, refer to the official documentation.