Question

How do I detect that the installer is doing a repair?

Answer

You can check if the REINSTALL property is set. If you want to detect if a patch operation is happening (which also sets the REINSTALL property), you can check if the PATCH property is set (or the MsiPatchRemovalList property for patch uninstall).

Content credit belongs to

[Author: Robert Flaming]
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 http://www.microsoft.com/info/cpyright.htm.