29

I'm trying to figure out how Windows (XP through 7) is handling installation and uninstallation of MSI files. I have come up in situations where Windows Installer is unable to uninstall because it's missing the original MSI file, which leads me to believe that it stores a copy of all installed MSI packages somewhere. Where?

I've had a couple of theories.

  1. It expectes it to reside in the same folder as it was installed from. The registry keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall does point to the original installation folder, and error messages when the MSI file is missing often point to this. Removing the MSI file from this folder does not hinder the uninstallation process though, so I've refused this theory.

  2. C:\Windows\Installer. This folder actually contains a bunch of seemingly randomly named MSI files. But this list is incomplete. I do find entries in the registry key mentioned in 1) which does not have an MSI copy in this folder.

So how does this work? How is windows installer able to uninstall MSI-installed applications even though the MSI is not in 1) and not in 2)?

2
  • Windows does not always keep it. There are many ways for the user to tell Windows to actually clear its cache of these files. If you have software that cannot be uninstalled then it means the developer built the installer wrong. The location will be different between Windows XP ( why are you worried about an unsupported operating system ) and Windows 7 and/or Windows 8.
    – Ramhound
    Sep 13, 2012 at 11:39

1 Answer 1

53

Apparently it works like this (On Windows 7, I do not know about XP and other OSes):

When a user installs some app, Windows does the following:

1) Creates a registry key

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[ProductId GUID]

for this app.

If you have access to the original msi file of installer of your app, you can find [ProductID GUID] by opening the msi file in orca.exe and clicking on the "Property" on the left in orca, and looking for "ProductCode" line on the right. If you do not have access to original *.msi file, you can just search registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall for the name of the app.

If you want to delete your app (which refuses to uninstall for example) from the list of installed apps in Control Panel, you can delete the entry from this Uninstall key. It will surely disappear from the list in control panel, but Windows will still remember it. For example, if you try to install a next version of the same app, Installer may still insist on uninstalling the previous version. See item 2 for that.

2) Windows copies the original *.msi file into the folder C:\Windows\Installer and renames it to a random name (keeps .msi extension though). Windows also creates a key in registry in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\[InternalUserId]\Products\[some random guid-like sequence of chars identifying to windows your installation]\InstallProperties. ValueName "LocalPackage" in this reg key will point to the renamed msi file. To find the file in C:\windows\Installer you can navigate to this folder in Windows explorer, switch it into Details view, make column "Subject" visible and you will see for all nnnnnnnn.msi fies their corresponding name of product.

2
  • 10
    I wanted to up-vote you twice for the hidden secret - make column "Subject" visible and you will see for all nnnnnnnn.msi fies their corresponding name of product.. Windows is such a mysterious operating system :P
    – RBT
    Jan 19, 2017 at 6:00
  • 3) Step 3 was necessary for me. I had to copy the 5188bfc6.msi file ( hex#.msi ) and rename it to the original file name MyApp.msi, before uninstaller would accept the file. After this uninstall worked fine.
    – Joe B
    Oct 6, 2017 at 15:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .