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.
- The exe or command always goes first (surprisingly!)
msiexec
ormsiexec.exe
. - Install action goes next! -
/i
(Install) or/x
(Uninstall). - Path to your MSI file or Product Code in curly braces
{}
for uninstalling via GUID -filename.msi
or{GUID}
. - Switches go next -
/QUIET /NORESTART /L*V "C:\Temp\log.log"
. - Other Properties last -
PROPERTY=VALUE
(e.g.,SILENT=TRUE
,ALLUSERS=1
).
For more information on properties
Use the link here
Example Commands
# Install Command
msiexec /i "App.msi" /QUIET /NORESTART /L*V "C:\Windows\Temp\App-install.log" SILENT=TRUE ALLUSERS=1
# Uninstall command
msiexec /x {00000-000000-0000000-0000000} /QUIET /NORESTART /L*V "C:\Windows\Temp\app-uninstall.log"
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 theSYSTEM
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.