MsiExec is the command to control the windows installer, which is the service that allows you to install msi, msp and mst files.
This description is by no means complete. You can get many more options just by running the MsiExec command without any arguments. However the description that you get there does not really tell you how to use the command. This text explains the most commonly used options, and shows examples.
If you want only the take home message for a cheat sheet, scroll down to the last two lines.
To install a software package in the most simple case, run this command:
MsiExec /i package.msi
But in most cases you may want to at least add the /qb option, see below.
Software packages that were deployed as msi can be updated by applying a patch in an msp file. Not all software vendors provide msp.files, but if they do, this is usually faster than uninstalling the old version and then installing the new version.
MsiExec /update update.msp
Note: Group Policy for Software Deployment cannot trigger such an update. For GPO-deployment you must slipstream the patches into an AIP and deploy that. For upgrading to a new version make a new AIP, and deploy it as replacement, not as update (will case the old to be uninstalled before installing the new).
Sometimes you want to install a software package, for which there is already an update available as msp-file. You can do this in one step.
MsiExec /i package.msi /update absolute-path\update.msp
Notes:
Example (install Adobe Reader 11.0.13 with one single command):
MsiExec /i AdbeRdr11000_en_US.msi /update c:\temp\AdbeRdrUpd11013.msp
The windows installer allows to apply settings to a software package during deployment. This is done by specifying one or several mst-files. This option can be appended to any of the previously shown examples.
TRANSFORMS=settings.mst
It is possible to apply several transforms by listing them separated by semicolons:
TRANSFORMS=set1.mst;set2.mst
Transforms are usually applied when deploying the msi, not when updating with a patch. The option can be specified together with /update, but it will often not have the desired effect when specified only there.
Example (install Adobe Reader from a slipstreamed AIP, applying output of Customization Wizard):
MsiExec /i AcroRead-11.0.13.AIP\AcroRead.msi TRANSFORMS=Wizard-Settings.mst
A software package previously installed from an msi file can be uninstalled with this command:
MsiExec /x package.msi
An alternative is to find the product code GUID (by viewing the msi-file with Orca, or by browsing the registry in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall) and specify that.
MsiExec /x {GUID}
Example:
MsiExec.exe /x {FF24F097-D090-41D2-8E9C-BAFEBBFD938C}
The most commonly used option is the one which allows to do unattended deployments, by supressing all requests for user input. It makes the installer use the defaults instead of asking any questions:
/qb
This option comes in a variant which additionally also disables the abort button in the message window, which shows the progress:
/qb!
There is related option which appears to be useful, that not only suppresses all questions, but also all output. However you should better not use it, because some software does not deploy correctly when installed with this option:
/qn
If an install or update does not work, it can be useful to let MsiExec write a log file. That usually contains hints why it did not work (hidden in the middle of thousands of irrelevant lines):
/L*v c:\MsiExec-output.txt
These options can be specified anywhere on the command line. I suggest to put them directly behind the MsiExec command.
The Windows Installer can only handle one simultaneous task. Always wait until one installer process is finished before starting another one.
If you enter an MsiExec command on the command line, it will immediately return, while the windows installer service is still performing its work. However if MsiExec is called from a bat or cmd script, then MsiExec will wait until the task is finished before it returns. This makes it possible to write several MsiExec commands into one script and have them being processed one after the other.
Filenames which contain spaces must be enclosed in double quotes. Examples:
MsiExec /qb /i "great app.msi" /update "c:\path\new patch.msp"
MsiExec /qb /i app.msi TRANSFORMS="default.mst;my defs.mst"