New tool that will be integrated into the VS 2005 cleanup tool - your feedback requested

We have seen some cases where the new VS 2005 cleanup tool fails to fully remove previous VS 2005 beta products. Behind the scenes, the cleanup tool searches for a list of known previous beta product codes, and if it is found, it will try to run msiexec /x for each product code that is found to be installed on the machine. However, there are some cases where msiexec /x fails to uninstall the product and additional steps need to be taken.

In order to address this set of scenarios, I have been working on a standalone tool that can be run as an action by the cleanup tool or as a standalone tool. There is a version of this tool, called smartmsizap, that can be downloaded from this location. In order to use the tool, you can run smartmsizap.exe /p {product_code}. It uses msiexec /x and msizap behind the scenes.

I'm interested in getting feedback from anyone reading this regarding the logic behind the scenes for this tool. Here is a rough outline of what it does behind the scenes:

  1. Takes the product code passed in with the /p switch and call MsiQueryProductState
  2. If MsiQueryProductState is equal to INSTALLSTATE_UNKNOWN or equal to INSTALLSTATE_INVALIDARG, then return without doing anything
  3. Call MsiGetProductInfo with the INSTALLPROPERTY_LOCALPACKAGE parameter to retrieve the locally cached MSI package
  4. Check to see if the locally cached MSI package exists in the expected location
  5. If it does not exist, run msizap TP {product_code} and then return
  6. If it does exist, try to run msiexec /x {product_code} /qn REBOOT=REALLYSUPPRESS and check the return code
  7. If msiexec /x returns success, then return
  8. If msiexec /x fails, run msizap TP {product_code} and then return

I'm still testing this out in various scenarios as I run into weird dirty machine states. But I'm curious if there are any holes in this logics that I've missed so far. Let me know what you think by posting comments or contacting me.

Once we get some additional testing, we'll get this exe integrated into a later version of the cleanup tool to make it able to cleanup additional scenarios that it currently can't resolve because it does not run msizap.exe currently.

<update date="4/1/2009"> Fixed broken link to smartmsizap tool. </update>