How should I determine the success or failure of a Windows Installer install?
Question
How should I determine the success or failure of a Windows Installer install?
Answer
Generally there are two ways of invoking Windows Installer, a MSIExec command line call or an MSI API (MsiInstallProduct, MsiInstallProductEx, MsiReinstallProduct).
For the MSIExec case
- If one is calling via the command line, they can look at the ERRORLEVEL of the command shell to see if Windows Installer returned success (zero).
- If one is using the an API to call the command line (like CreateProcess) check the return value available through that API as you would above.
For the MSI API case, consult the MSDN documentation on the API to determine which of the parameters determines success.
Where the problem gets interesting is when there is a failure as there is no automated way to determine with 100% accuracy what a source of an error has been. We have produced a best effort tool called wilogutl.exe that will highlight errors in the MSI. In this case best effort means there will be some false positives (cases where the error is inconsequential) and some negatives (cases where errors are known only by analyzing a combination of lines from the log along with the package).
As a windows installer dev in test, I found it most helpful to examine the verbose log file generated during the install and see what the MainEngineThread returns.
[Author: Ken Wong]
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm.
Comments
- Anonymous
September 25, 2005
Not that there are a couple of other return codes from msiexec.exe that also indicate success.
For example, if you have suppressed reboots (REBOOT=REALLYSUPPRESS) and a reboot is required then msiexec will return 3010. Likewise, then return code for "reboot in progress" is non-zero. - Anonymous
September 27, 2005
wilogutl.exe is required becaus of the hard to read formatting of the logging, and this is also why it can be hard to find out where things go south, couldn't it be great if the logging was improved...
My 2 cents worth,
Dennis