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

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>

Comments

  • Anonymous
    July 03, 2005
    Hi Aaron, I am having trouble creating the users in the active directory that are required for the installation of Team Foundation Server! Can you please provide me with the step-by-step guide for installing Team Foundation Server! Thanks.

  • Anonymous
    July 04, 2005
    I notice the filedate on MSIInv.EXE is 2001.

    Does it inspect properties of the MSI database / installer that are current in the Windows Installer v3.1 ?

  • Anonymous
    July 05, 2005
    Hi Balajik - there is a lot of good information about Visual Studio Team System at http://lab.msdn.microsoft.com/teamsystem/. For example, I found this download location for a Team Foundation Server installation guide that might be useful to you - http://www.microsoft.com/downloads/details.aspx?FamilyId=E54BF6FF-026B-43A4-ADE4-A690388F310E&displaylang=en.

    Hope this helps!

  • Anonymous
    July 05, 2005
    Hi Ian - yes, even though the file has not been updated for a while, it still works with MSI databases that are using the Windows Installer 3.0/3.1 schemas because it uses public APIs to access the behind-the-scenes data, and those APIs are designed to be backwards compatible.

    Please let me know if you see any issues where it is not behaving as expected.

  • Anonymous
    July 05, 2005
    Hi Aaron - I already read the installation guide before posting here. I followed the steps in that guide. Like i said, i am having problems adding the Active Directory Domain user accounts needed for the installation. This installation is not as easy as VS 2005 or SQL 2005 or any other i've done before!

    Thanks for your help!

    Balaji K.

  • Anonymous
    July 05, 2005
    The comment has been removed

  • Anonymous
    July 05, 2005
    Hi Aaron, Even i don't have any experience with the 'Domain Controller' server role in Windows 2003 and these domain user accounts. As a result, i'm lost. Ok, I'll try the MSDN forums and let you know if i was successful.
    Thanks again!

  • Anonymous
    September 13, 2005
    I have heard from a few customers (inside and outside of Microsoft) who have had problems uninstalling...

  • Anonymous
    October 21, 2005
    Hi,

    I am trying to install sql server 2005 September 2005 ctp, but it is hanging at "Detecting Installed ISS". Can you please help regarding the same.

    I had VS.2005 beta 2 installed, but i though that might be because of this, and have uninstalled everything and trying to install sql server 2005, but no success. can you please help.

    my OS is : XP Prof. SP2
    Nortan Antivirus is installed.

    Thanks
    Gaurang

  • Anonymous
    October 25, 2005
    Hi Gaurang - can you please gather the SQL setup log files and send them to me at aaronste@microsoft.com so I can take a look and see if I can figure out what the problem is here? You can find the logs at %ProgramFiles%Microsoft SQL Server90Setup BootStrapLOGFiles*.*

  • Anonymous
    November 10, 2005
    The comment has been removed

  • Anonymous
    November 13, 2005
    Thank you so much for you help. I was considering much more drastic action to get my true MSDN versions of SQL and VS installing.

  • Anonymous
    January 04, 2006
    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.

    How do I remove this product? Awaiting your response.

  • Anonymous
    February 10, 2006
    メモ: Visual Studio 2005 Express/SQL Server 2005 Express などのプレビュー版アンインストール手順

  • Anonymous
    February 20, 2006
    The combination of msiinv.exe and msiexec /x did the trick for me (or at least so it seems).

    Thanks,
    Eyal

  • Anonymous
    March 02, 2006
    WOW... Finally I'd been fighting this for 3 months now. Thanx... I was ready to grab a 20 pound magnet:) Works fine now

  • Anonymous
    March 05, 2006
    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?

  • Anonymous
    March 05, 2006
    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....

  • Anonymous
    April 02, 2006
    Duuuuuuude! You are the man...I am 3 hair-strands away from being bald trying to get the install to work. Thank you.

  • Anonymous
    May 06, 2006
    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?

  • Anonymous
    May 07, 2006
    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.

  • Anonymous
    May 07, 2006
    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?

  • Anonymous
    May 07, 2006
    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?

  • Anonymous
    May 08, 2006
    Thank you - huge relief.  The smartmsizap finally did it.

  • Anonymous
    September 02, 2006
    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:WINDOWSInstallvs_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!

  • Anonymous
    September 02, 2006
    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?

  • Anonymous
    September 02, 2006
    Bingo! The smartmsizap tool removed the lingering info! Thanks very much.

  • Anonymous
    September 17, 2006
    PingBack from http://blog.xpint.net/?p=6

  • Anonymous
    December 06, 2006
    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.

  • Anonymous
    December 07, 2006
    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!

  • Anonymous
    December 24, 2006
    for some reason I cannot get it to produce a text file, i have tried c:msiinvmsiinv.exe -p> c:msiinv_output.txt; this pops up the cmd window for just a sec but no text file. also tried c:msiinvmsiinv.exe > c:msiinv_output.txt; which brings the cmd window and i can see all the output but it still doesnt produce a text file. thanks for your help.

  • Anonymous
    December 25, 2006
    The comment has been removed

  • Anonymous
    January 21, 2007
    Si certains d'entre vous ont installé la beta du SP1 sur leur Team Foundation Server, vous aurez certainement

  • Anonymous
    April 19, 2007
    The comment has been removed

  • Anonymous
    April 19, 2007
    Hi Rmg1 - I see 2 items in the msiinv list posted there that are beta products that will need to be removed: {B10D2D36-B94C-4A28-9FAD-0606CA8E39C4} {B2A2C64F-AFA1-4BF0-9879-1071EF0C950C} These are both from the VS 2005 beta 1.  The first is the J# Express Edition and the second is the MSDN Express Edition. Can you please try to remove these 2 products using steps 3-7 listed at http://blogs.msdn.com/astebner/archive/2005/10/30/487096.aspx and see if that resolves this issue?

  • Anonymous
    April 20, 2007
    Thanks Aaron I'm no longer going bald!! ;-)

  • Anonymous
    June 27, 2007
    My uninstallation of Visual Studio Express C# has been suspended.  I began to uninstall but after after about 5 hours, it appeared that the uninstall wasn't really working so I "ended" it.  Now, i can't find any way to "resume" it.  I've tried just about everything I can think of.  When I try to use Add/Remove hardware, I get a message saying that the vs_setup.msi file can't be opened. Also, according to the output produced by msiiv, C# and J# "aren't installed"  However, they show up everywhere else (add/remove, program files, etc). Any ideas? I'm at a loss with this one... Thanks

  • Anonymous
    June 28, 2007
    Hi Coker - It sounds like the uninstall was mostly completed (since you do not see these products in the msiinv output), but it is not completely done because you still see them in Add/Remove Programs.  I think the cleanest solution would be to re-install these programs and then uninstall them again.  If that doesn't help or you don't want to go through that hassle, you can manually remove the files from Program Files and registry keys that are used to display the entries in Add/Remove Programs (they are located in a sub-key under HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionUninstall and you can search for them by the names of the products).

  • Anonymous
    July 08, 2007
    Si certains d'entre vous ont installé la beta du SP1 sur leur Team Foundation Server, vous aurez certainement

  • Anonymous
    July 08, 2007
    Si certains d&#39;entre vous ont installé la beta du SP1 sur leur Team Foundation Server, vous aurez

  • Anonymous
    October 25, 2007
    Thanks for the great post. I successfully removed my application. I cannot believe how easy if was to create a msi pack. Why am i finding it so hard to figure out how to create an uninstall so i dont how to go about this round about way. Any links or suggestions?

  • Anonymous
    October 25, 2007
    Hi Rouxbox - I'm not sure I understand your question.  An MSI supports installing, repairing and uninstalling.  You don't have to create a separate package for uninstall - you should be able to use the same package that you use for install.  Can you please clarify the exact problem you're running into related to uninstall so I can try to help better?

  • Anonymous
    October 28, 2007
    The comment has been removed

  • Anonymous
    October 28, 2007
    The comment has been removed

  • Anonymous
    October 28, 2007
    The comment has been removed

  • Anonymous
    October 29, 2007
    Hi Searcher54 - The error 1605 is a Windows Installer error code that means "This action is only valid for products that are currently installed."  Likely this means that one of the installed products on your system is in a bad/inconsistent state, and that is confusing msiinv and the WIndows Installer Cleanup Utility.  I'm not sure how to narrow down exactly what product is causing that error though.  It might help to use the -v (verbose) switch on msiinv.  If you want, you can run msiinv in verbose mode and zip and send me the log file so I can see if I can figure out anything about the root cause.  You can send the log file to Aaron.Stebner (at) microsoft (dot) com.

  • Anonymous
    November 21, 2007
    I previously wrote about a log collection tool that will automatically gather and cab up Visual Studio

  • Anonymous
    November 21, 2007
    I previously wrote about a log collection tool that will automatically gather and cab up Visual Studio

  • Anonymous
    December 01, 2007
    Visual Studio 2008 - Install Problem Solved

  • Anonymous
    December 21, 2007
    This week with the RTM of VS2008 I made the move from the Beta 2 version of VS2008 to the RTM version.

  • Anonymous
    February 07, 2008
    Since XNA Game Studio 2.0 shipped back in December, we've heard of a few installation issues from customers

  • Anonymous
    February 07, 2008
    Since XNA Game Studio 2.0 shipped back in December, we&#39;ve heard of a few installation issues from

  • Anonymous
    November 30, 2008
    Hi, do you know of an alternate source of msiinv.zip?  The website for it appears to be gone or down. Thank you!

  • Anonymous
    December 01, 2008
    Hi Dkwright - I've sent out mail to ask the owner of that site whether this is a temporary or permanent outage.  In the meantime, I've posted this file for download at the following alternate locations: http://astebner.sts.winisp.net/Tools/msiinv.zip http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog%7C_Tools/msiinv.zip

  • Anonymous
    December 01, 2008
    Thank you.  I really appreciate it!

  • Anonymous
    December 04, 2008
    I just tried running this on my laptop with Vista SP1 installed and I get "Unexpected Error: 1605 <>" repeated 3 times in the command prompt window and no output file. Any thoughts?

  • Anonymous
    December 04, 2008
    Hi Dasharp - I've seen these 1605 errors in the past on some systems.  They usually mean that there is some incorrect Windows Installer data somewhere in your registry.  However, I also looked at the code for this MsiInv tool and it should continue even after hitting errors like that and continue to list installed MSI-based products.  Are you sure it didn't list anything in the log file?  Are you looking in the right location on your file system for the log file to be produced?

  • Anonymous
    December 04, 2008
    I forgot to put the folder in output redirect. I found the file. Thanks.

  • Anonymous
    December 18, 2008
    The comment has been removed

  • Anonymous
    December 18, 2008
    The comment has been removed

  • Anonymous
    December 19, 2008
    The comment has been removed

  • Anonymous
    December 19, 2008
    The comment has been removed

  • Anonymous
    June 30, 2010
    Thank you for excellent article! It was very-very helpfull for me (I had a big problem with uninstalling Visual Studio 2010 ultimate trial)

  • Anonymous
    November 14, 2010
    Tried to upgrade SQL Express 2008 to 2008R2. For some reason the upgrade failed which left my server in a half way installed state. The above procedure helped me to get rid of both 2008 a 2008R2.

  • Anonymous
    April 07, 2011
    Hi Aaron, I am using msiinv.exe to monitor a build server farm (ccnet). I get different results when I run under two different domain logins. I'm wondering if the API is returning msi entries visible to the user? I will try to confirm this - however, would appreciate some guidance from the author. thx. Appreciate the excellent tool! Andy, NZ

  • Anonymous
    April 10, 2011
    The comment has been removed

  • Anonymous
    January 27, 2014
    Thank you so much for this. I've manage to uninstall the remnants of a program that's been annoying me for months. It had preventing me from reinstalling the software properly. Fabulous work!

  • Anonymous
    July 07, 2014
    Hi Aaron, I tried the instructions above at the cmd prompt but I got this message "'C:msiinvmsiinv.exe-p' is not recognized as an internal or external command,operable program or batch file" I can run the c:msiinvmsiinv.exe no problem...I just cannot read that fast! What noob mistake am I making here? Thanks for all your help!

  • Anonymous
    July 07, 2014
    Hi keith42 - You need to put a space between msiinv.exe and -p. Can you please give that a try and let me know if it works for you?

  • Anonymous
    October 06, 2014
    Hello Aaron, I am trying to uninstall the PC Fix Speed and Optimize Your PC which are know to have some malware. I downloaded the file and followed the steps, but these two programs do not show up. I am at a loss. Do you have any suggestions?

  • Anonymous
    October 06, 2014
    Hi Shan - The instructions in this blog post only work for applications that use Windows Installer for their setup programs.  If you don't see this application in the list after running msiinv.exe, then it likely doesn't use Windows Installer, and you'll need to use some other means to uninstall it.  There might be an entry in the Programs and Features control panel that you can use to uninstall it, or there might be an uninstaller program in the same directory as the application itself.

  • Anonymous
    March 06, 2015
    So somehow my .NET Framework got updated to 4.5.2 during a windows update. While attempting to reinstall Visual Studio 2013 v3, it would simply error out claiming the 4.5.1 .NET Framework could not be installed. When checking the log, it gave no indication it's failure was due to a more recent .NET package. Searching a good load of articles on the microsoft website did nothing. Not only that, the FixIt #50123 which is supposed to help fix corrupted MSI packages didn't even mention I was running 3 different versions of .NET framework! After tracking down where on the Install CD this package was, I was able to manually run it and see a more detailed error log (I'm sure I could have done this via the VS setup, but it wasn't until reading the comments here that I got the idea). After using the steps you outlined, I quickly found that although the .NET framework wasn't listed in the installed apps, it was on the system, cloaked as a windows KB update. After removing it, again using your easy to follow instructions =D, I was able to finally, after two weeks of pain, reinstall my VStudio! I can not thank you enough!

  • Anonymous
    September 04, 2015
    The program I'm searching for didn't show up in the output. What do I do?

  • Anonymous
    September 05, 2015
    Hi Adrian Arroyo - That means that either the program isn't currently installed on your PC or the program doesn't use Windows Installer for its setup technology.  What is the exact program that you're searching for in your scenario?

  • Anonymous
    May 13, 2016
    Can we provide this tool via Chocolatey ?

    • Anonymous
      May 13, 2016
      Hi majkinetor - I'm sorry, but I don't have any plans to deliver this tool via other sites at this time. Are you having trouble downloading it from the link that I provided?
  • Anonymous
    June 02, 2016
    The comment has been removed

    • Anonymous
      June 02, 2016
      Hi Matthew Copeland - Error 1605 means that there is some data in your registry that the Windows Installer APIs don't know how to process. The rest of the output from the msiinv.exe tool is still valid though, so you can continue using the output for your scenarios despite seeing those 1605 errors.
      • Anonymous
        June 11, 2016
        Thanks Aaron!It would be interesting to know what registry entries were causing the problem. Is this an indication that the registry data does not match the data in the installer database?
        • Anonymous
          June 14, 2016
          Hi Matthew Copeland - The registry entries are intentionally stored in an obfuscated format to discourage people from directly querying the registry and instead steering them towards the Windows Installer APIs. When I've seen that type of error in the past, it typically meant that there was an orphaned key that indicated that a patch was installed but the base product wasn't actually installed or something similar to that. I haven't seen this type of issue cause any harm other than for reporting tools like msiinv.exe that use Windows Installer APIs to mine data from the Windows Installer registry sub-key, so I don't think you need to worry about it.
  • Anonymous
    January 04, 2017
    how to run this.. step by step plz

    • Anonymous
      January 04, 2017
      Hi Jeordan - This blog post has 4 numbered steps that explain exactly how to download and run this tool. Can you please give those a try and let me know if you have any questions or run into any issues?
  • Anonymous
    March 03, 2019
    Aaron, I've put the original source and .exe for MSIINV.exe up at https://github.com/ZisBoom/MsiInv.exe. You're welcome to use it from there, or continue with your OneDrive share. (I'm the original author.)