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 69

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>

 

  • 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.
  • 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 ?

  • 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!

  • 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.

  • 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.
  • Hi Balaji,

    I'm sorry to say I don't have any experience with the user account issue you're running into. I would suggest looking around at issues on the Team System MSDN forums at http://forums.microsoft.com/msdn/default.aspx?ForumGroupID=5 and starting a new thread if you don't see anything related to your problem already posted there. You can also use http://lab.msdn.microsoft.com/productfeedback/ to report bugs that you find while trying to install beta versions of the VS 2005 Team System.

    One thing to note here - the setup is definitely more complicated, because it includes configuring VS and SQL plus some other server-side components. Any feedback you have on streamlining and improving the process is definitely welcome!

  • 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!
  • I have heard from a few customers (inside and outside of Microsoft) who have had problems uninstalling...
  • 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
  • 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 Server\90\Setup BootStrap\LOG\Files\*.*

  • That method using "msiinv.exe" to locate installed products looks fantastic. That is the most useful tool I've seen for all these previous version Beta headaches. Printing the installed contents to a text file is a great obvious idea.

    I have personally used "msicuu.exe" to similar effect. It also has command switches found by using the "msicuu /?" syntax. Download: http://www.microsoft.com/downloads/details.aspx?FamilyID=49ae8576-9bb9-4126-9761-ba8011fabf38&displaylang=en&Hash=QQQCR9C
  • 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.

  • 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.
  • メモ: Visual Studio 2005 Express/SQL Server 2005 Express などのプレビュー版アンインストール手順
  • The combination of msiinv.exe and msiexec /x did the trick for me (or at least so it seems).

    Thanks,
    Eyal
Page 1 of 5 (69 items) 12345
Leave a Comment
  • Please add 5 and 7 and type the answer here:
  • Post