How to extract files from a .msi file using the Windows command line

Every once in a while I need to extract the content of a .msi file in order to customize a deployment for a particular network environment. Sometimes initializing the .msi installer will temporarily extract the files into C:\Documents and Settings\\Local Settings\Temp, but those files are removed once the installer exits.

To extract files from a .msi file at the command line, type:

msiexec /a PathToMSIFile /qb TARGETDIR=DirectoryToExtractTo

For example, to extract files from f:\zenworks\zfdagent.msi into c:\zfd701 you would type:

msiexec /a f:\zenworks\zfdagent.msi /qb TARGETDIR=c:\zfd701

The destination directory does not need to exist prior to running this command.