Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Using MsiInv to gather information about what is installed on a computer

Using MsiInv to gather information about what is installed on a computer

Rate This
  • Comments 71

As I was reading one of the posts on Quan To's new blog, I noticed that someone posted a link to a tool named msiinv.exe on their tools page.  This tool (which stands for MSI Inventory) wraps some of the publicly documented MSI APIs to provide information about the state of all Windows Installer products, features and components that Windows Installer thinks are installed on your computer.  I say "thinks are installed" because there are some rare cases where the actual installation state of a given product can get out of sync with the information Windows Installer has stored in its internal data structures, which can cause confusion for setup packages.

I use this tool nearly every day as one of the first troubleshooting tools for setup problems because it allows me to get a baseline snapshot of what the current state is for a machine before I start trying to make changes to fix any problems a customer might be having.

Example usage of msiinv.exe

One of the common uses of msiinv.exe is if someone is trying to install one of the recent beta builds of VS 2005 or .NET Framework 2.0 and the setup UI states that you are not allowed to install because a previous beta version of <insert product name here> is on the machine and you must uninstall that first.  Sometimes after receiving this error message, a user will look in Add/Remove Programs and the product that setup is complaining about is nowhere to be found, or there is an Add/Remove Programs entry for that product but trying to remove it claims that the product is not on the computer and asks if you would like to remove the entry from the Add/Remove Programs list.

In these cases, you can use the following steps:

  1. Download msiinv.zip from the following location:



  2. Extract the contents of msiinv.zip to the folder c:\msiinv on your system
  3. Click on the Start menu, choose Run, type cmd and click OK
  4. Type this command:  c:\msiinv\msiinv.exe -p > c:\msiinv\msiinv_output.txt

    Note: This command must be run from a cmd prompt or it will not create a log file as expected.

These steps will create a text file named c:\msiinv\msiinv_output.txt with a list of each product that Windows Installer thinks is installed on the system.  Then you can open the text file in any text editor and search the list of products for the name of the product that setup told you to uninstall.  The output will look something like this (I am using an example from a machine that has .NET Framework 2.0 beta 2 installed):

Microsoft .NET Framework 2.0 Beta 2
 Product code: {7A1ADD0C-17F3-47B8-B033-A06E189C835D}
 Product state: (5) Installed.
 Package code: {856D48D2-6F94-466D-9732-534DB5854FB3}
 Version: 2.0.50215
<note: there is more info after this but I am omitting it because it isn't useful to the rest of my example>

Now we have the Windows Installer product code and we can use that to uninstall the product by running msiexec /x <product code> (make sure that you include the curly braces in this command line).  If the product is actually installed on your system you will see a progress screen and uninstall will complete, and from there you should be able to re-run VS or .NET Framework setup and successfully install.

If Windows Installer thinks that the product is installed but it really isn't, then running msiexec /x <product code> will give you an error stating that this command is only valid for installed products.  If this happens, you will need to perform an extra step to remove the data that causes Windows Installer to think this product is installed.  You can download the Windows Installer Cleanup Utility and install and run it on your machine to fix this.  In the list of applications that this tool displays, choose the one that matches the product name displayed when you first ran VS or .NET Framework setup and choose to remove it.  After this removal completes, you should be able to re-run VS or .NET Framework setup and successfully install.

Advanced usage of msiinv.exe

The msiinv.exe tool has several command line parameters that you can see by running it with the /? switch.  A couple of the more interesting options are the following:

  • msiinv.exe -v - This option will list all feature GUIDs and component GUIDs for each Windows Installer product that is installed on the machine.  This can be useful to see which products share components (which can help track down why running uninstall for one product leaves behind some files and/or registry).  If you have a lot of products installed on the machine, running with the verbose switch will take a long time.
  • msiinv.exe -x - This option will list Windows Installer components that are installed on the machine that do not have any products that hold reference counts on them anymore.  In most cases, this is caused by one or more setup being installed on the machine at some point in the past that violated the MSI component rules. (more info about component rules can be found here and here if you are interested)

<update date="12/1/2008"> Updated the link to msiinv.zip because the old location was no longer available. </update>

<update date="2/12/2009"> Updated command line for running msiinv.exe so it will work on Windows Vista and Windows Server 2008. </update>

<update date="4/1/2009"> Removed broken link to msiinv.exe tool </update>

<update date="10/11/2012"> Embedded new SkyDrive link to msiinv.exe tool </update>

 

  • WOW... Finally I'd been fighting this for 3 months now. Thanx... I was ready to grab a 20 pound magnet:) Works fine now
  • I cannot, for the life of me, get this exe to output anything. I see all the info while it's running, and can pause it and look through the information, but it won't output anything to a text file. I've tried running it through the command prompt and just plain opening it. I've put it in several different directories as well. It took about 4 run throughs just to create the output.txt file in the C: directory, but it is empty no matter how many times I run the program now. I'd really like to not have to pause the program, search through the listings, find what I'm looking for, and write down the product code with my hand on the mouse to have to do this... what's the matter with me?
  • Hi James - You have to use the greater than sign ( > ) to redirect the output from the console window to a text file.  The following steps should allow you to do this:

    1.  Click on the Start menu, choose Run and type cmd

    2.  Type msiinv.exe > c:\output_file.txt

    These steps should cause no text to be printed in the cmd window, but instead it should appear in the text file.  Hope this helps....
  • Duuuuuuude! You are the man...I am 3 hair-strands away from being bald trying to get the install to work. Thank you.
  • Installing Visual Studio 2005 tells me that I need to uninstall SQL Server 2005 Express Edition (plus others) but msiinv doesn't find it, and nor does the cleanup. (Yes, I had the beta installed and started an uninstall before cracking the shrink wrap on VS2005 and did it in the wrong order).
    How do I find these in order to uninstall?
  • Hi Ormond - If Visual Studio 2005 setup tells you that there is a beta version still installed, then you will need to take a look at the list of products at http://msdn.microsoft.com/vstudio/support/uninstall/default.aspx and compare the product names that need to be removed to the ones listed in your MsiInv output.  One or more of them will match, and those are the ones you need to remove.
  • Thanks Aaron.  msiinv twice gives "Unexpected error: 1605 ()" but gives the output. MSDN Library for Visual Studio 2005 Beta 2 was first on the web site list and was there so I tried uninstalling that using Add/Remove Programs. This gives a "Fatal error during installation" and doesn't remove it.
    msiexec /x with the product code and logging into a file also doesn't remove it.
    Will a full reinstall of the beta and then a correct uninstall fix this?
  • Hi Ormond - You will likely need to use steps like the ones listed at http://blogs.msdn.com/astebner/archive/2005/11/03/488936.aspx in order to resolve this MSDN uninstall issue.  Can you try that out and see if it helps?
  • Thank you - huge relief.  The smartmsizap finally did it.
  • I'm trying to remove the phantom Microsoft Visual Studio 2005 Team Suite. After running the VS 2005 troubleshooting tool, I get the following message:

    Error 1316. A network error occurred while attempting to read from the file: C:\WINDOWS\Install\vs_setup.msi.

    It probably fails because that file does not exist.

    I get the same error message using the msiexec /x <product code> method.

    Running the Windows Installer Cleanup Utility mentioned above (msicuu2.exe) prompts me with a few 'Next >'s then tells me that the features I selected are currently being uninstalled ... but it never gave me the opportunity to see or select. Maybe it did something useful. I move to the next step.

    Trying to install VC# Express brings me back to the original problem -- I need to uninstall Team Suite.

    Any suggestions? Thanks!
  • Hi Gary - Can you please try the steps listed at http://blogs.msdn.com/astebner/archive/2005/10/30/487096.aspx to locate and manually remove Visual Studio Team Suite and see if that helps resolve this issue?
  • Bingo! The smartmsizap tool removed the lingering info! Thanks very much.
  • PingBack from http://blog.xpint.net/?p=6
  • I have the same problem as Syed Irtaza Ali

    I tried using msiexec /x {90032DD0-ABEE-4424-AC1E-B076BDD4E350}.

    But it just runs the remove process and the following text appears..."Please wait while Windows configures Microsoft SQL Server 2005 Beta 2". After that nothing happens and the window closes. When I run the msiinv.exe again, the product is still listed as installed.

    Please help I couldnt remove these Betas for many hours.

  • Hi The-Eagle - You will likely need to use some manual uninstall steps like the ones described at http://blogs.msdn.com/astebner/archive/2005/09/13/465401.aspx to try to resolve this.  Hope this helps!

Page 2 of 5 (71 items) 12345
Leave a Comment
  • Please add 2 and 5 and type the answer here:
  • Post