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>


Comments (8)
  1. says:

    dear Friend How I Can Obtain the Product_ID of .Net FrameWork .NET 2.0 Beta 2, I See more than one Version for this product

    Regards Santiago

  2. Hi Santiago – I’m not sure what you mean by a product ID for the .NET Framework 2.0. You do not have to enter a product key of any kind during .NET Framework 2.0 setup. Can you provide more information about what versions you are referring to and where it is asking you for a product key?


  3. Taraxacum Ken says:

    Not clear how to run your tool. It asks for a command line including the product_code. I tried Run

    smartmsizap.exe /p {VS 2005} but it gives an error message

  4. Hi Taraxacum – you need to know the MSI product code for the product you want to uninstall in order to use this tool. You can use the steps at to figure out the product code.

    However, in the case of VS 2005, I would suggest using the automated cleanup tool that is linked to at the top of the uninstall instructions page at

    Hope this helps…

  5. Dave Lloyd says:


    I have tried the uninstall tool and it fails. That is why I was searching and found your blog. I have VS 2005 RC on my machine and I need to remove. No matter what I have tried it does not work. There is one common message I keep getting.

    Error 1322. A portion of the folder path ” is invalid. It is either empty or exceeds the length allowed by the system.

    Any help would be great.

  6. crawfr says:

    I cannot get the link to the smartmsizap tool to load.  Have you got it somewhere else?

  7. Hi Crawfr – Unfortunately, the file server I have been using is down and I don’t have an ETA for when they’re going to fix it.  For now, I can send you a copy of the tool via email if you contact me using  I’m sorry for the hassles.

  8. One of the questions I commonly receive from customers is how to uninstall a product when there is no

Comments are closed.

Skip to main content