Skip to main content

MSIExec Cheatsheet

MSIExec.exe is the Windows Installer executable for installing, modifying, and uninstalling MSI (Microsoft Installer) packages using command-line options.

RTFM, msiexec | Microsoft Doc

Command Format

The correct order for organising this command.

  1. The exe or command always goes first (surprisingly!) msiexec or msiexec.exe.
  2. Install action goes next! - /i (Install) or /x (Uninstall).
  3. Path to your MSI file or Product Code in curly braces {} for uninstalling via GUID - filename.msi or {GUID}.
  4. Switches go next - /QUIET /NORESTART /L*V "C:\Temp\log.log".
  5. Other Properties last - PROPERTY=VALUE (e.g., SILENT=TRUE, ALLUSERS=1).
For more information on properties

Use the link here

Example Commands

Example using the Zoho and Forcepoint MSI install commands, which have a custom properties SILENT=TRUE, WSCONTEXT and XPSWDRF (uninstall password), you'll find these properties on the Vendor installation documentation.

# Zoho Installer - it's not the real msi name either FYI.
msiexec /i "ZohoMsi.msi" /QUIET /NORESTART /L*V "C:\Windows\Temp\zohoinstall.log" SILENT=TRUE ALLUSERS=1
# Uninstall command
msiexec /x {00000-000000-0000000-0000000} /QUIET /NORESTART /L*V "C:\Windows\Temp\zohouninstall.log"
# Forcepoint Installer - demonstrating mutliple properties in the install command - gets pretty long annoyingly!
msiexec.exe /i "Websense Endpoint.msi" /QUIET /NORESTART /L*V "C:\Windows\Temp\forcepointinstall.log" WSCONTEXT="adadd434asdad-0" ALLUSERS=1
# Forcepoint uninstall command
msiexec /x "{00000-000000-0000000-0000000}" /QUIET /NORESTART /L*V "C:\Windows\Temp\forcepointUninstall.log" XPSWDRF="UninstallPasswordString"

In the curly braces above is the product code, which is a GUID, the Windows Installer service expects this to be in curly braces. You can though use the same msi file for the uninstall aswell like so.

msiexec /x "C:\Path\To\Installer.msi" /QUIET /NORESTART /L*V "C:\Windows\Temp\uninstall.log"

Some notes on the above:

info

If you are deploying from Intune, it will automatically append ALLUSERS=1 to your install string when it runs on the device.

  • Always finish with ALLUSERS=1 if you want something to install for all users, if the install happens under the SYSTEM context you probably don't require it, some MSI files may still require the flag to be set, so better safe than sorry!

  • /QUIET can be abbreviated to /qn. Consider this though, /qn is an older alias for /QUIET and does not include /NORESTART. So, using /QUIET /NORESTART explicitly ensures no restart.

  • C:\Windows\Temp\ is great for a log file output, if the folder does not exist, the log file creation will fail. A safer approach is to ensure the directory exists before writing logs or use a temp folder that will definitely exist already.