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
).
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:
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.