10

I have installed some MSI with GUID (0733556C-37E8-4123-A801-D3E6C5151617). The program registered in the registry: HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ ()

Value UninstallString = MsiExec.exe / I (0733556C-37E8-4123-A801-D3E6C5151617)

My question is: how utility MsiExec.exe knows the name and path to the file you want to run when you remove programs? Where in the registry this information can be found?

bakkal
  • 54,350
  • 12
  • 131
  • 107
Yuriy
  • 388
  • 1
  • 3
  • 8
  • Very good answers already, but **the easiest way** to get information about your installed product is probably [**using a simple PowerShell command**](https://stackoverflow.com/questions/29937568/how-can-i-find-the-product-guid-of-an-installed-msi-setup/29937569#29937569) – Stein Åsmul Aug 20 '17 at 18:02
  • Reading this again I think I misread your question. I suppose the actual answer to your question is that all information about installed products is stored in the registry under ``HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer``. This is **the Windows Installer database** and you must never touch any values here directly. Rather you can access them via [Win32 API calls (C++)](https://msdn.microsoft.com/en-us/library/windows/desktop/aa369426(v=vs.85).aspx) or you can use [COM automation](https://msdn.microsoft.com/en-us/library/windows/desktop/aa367810(v=vs.85).aspx) (easier). – Stein Åsmul Oct 07 '17 at 22:06
  • This question is confusing: the title should read "How to find **uninstaller** location in registry, if I know MSI GUID?". Usually MSI-uninstaller is not stored in the directory where the application is installed. – AntonK Jul 17 '23 at 12:28

7 Answers7

16

Windows keeps Windows Installer configuration information hidden and encrypted in the Registry. It is not browseable with the human eye as other parts of the Registry are.

To query/modify/delete this information, you'll need to use MSI functions.
(Installer Function Reference)

For your particular question, try the function MsiGetProductInfo.

William Leara
  • 10,595
  • 4
  • 36
  • 58
  • 3
    Hidden and encrypted - really? – Rup Aug 13 '10 at 17:44
  • 1
    See [Tao of the Windows Installer, Part 2](http://blogs.msdn.com/b/windows_installer_team/archive/2006/05/12/595950.aspx) from the [Windows Installer Team Blog](http://blogs.msdn.com/b/windows_installer_team/). See Rule 21: Avoid Using Configuration Data You Don’t Own. It says, "This data is managed by the Installer and direct access by users or applications is discouraged; in fact some of the data is encoded to make it very difficult to manipulate manually." – Dan Jagnow Nov 04 '13 at 14:50
11

Here's a simple c# program that uses MsiGetProductInfo, as William Leara says, to get the actual location of the cached installer on disk.

class Program
{
    static void Main(string[] args)
    {
        Int32 len = 512;
        System.Text.StringBuilder builder = new System.Text.StringBuilder(len);
        MsiGetProductInfo("{89C098E5-C108-49F9-9B1D-10503C6D8A05}", "LocalPackage", builder, ref len);
        Console.WriteLine(builder.ToString());
        Console.ReadLine();
    }

    [DllImport("msi.dll", CharSet = CharSet.Unicode)]
    static extern Int32 MsiGetProductInfo(string product, string property, [Out] StringBuilder valueBuf, ref Int32 len); 
}
Sue Maurizio
  • 662
  • 7
  • 17
  • As seen in the code snippet, the string `property` can (and must) omit `INSTALLPROPERTY_`. Also the case of the letters matters, e.g. for `INSTALLPROPERTY_INSTALLLOCATION` it is `InstallLocation` (as similar to LocalPackage). – Roi Danton Aug 21 '18 at 09:35
10

You could try, from the command line:

wmic product where "Name like '%your software here%'" get Name, Version, PackageCode
chris
  • 101
  • 1
  • 2
5

You don´t need any software. This is working in Windows 10 and I think its valid for windows 7 as well.

If your Product Code is 0733556C-37E8-4123-A801-D3E6C5151617. Try to find the key C65533708E7332148A103D6E5C516171 (basically it's reversed) once you found it, browse for InstallProperties subkey, if doesn´t exists, try to find other result. Once you found InstallProperties, open and find the LocalPackage Key. And then you have the path for the msi packeage that MSI saves as Cache when you installed your application.

Andrés Falcón
  • 273
  • 2
  • 9
  • 1
    +1 Excellent tip. I've spent years looking at those HKEY_CLASSES_ROOT\Installer\Products subkeys and never recognized that it's the same guid broken into sections and reversed. I've never seen this info anywhere else on the internet. – user1169420 Mar 23 '21 at 19:34
1

There is a free utility from Tarma Software Research that I found helpful for this. Get it from their website.

JPaget
  • 969
  • 10
  • 13
1

That key maps to HKEY_CLASSES_ROOT\Installer\Products\.

Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • HKEY_CLASSES_ROOT\Installer\Products\ doesn't include path to installed program. Where ca I find it? – Yuriy Aug 13 '10 at 13:06
  • 1
    It doesn't need the path to the app that was installed, what if it installed 10 applications?, all it needs is the path to the uninstaller (or .msi module). Take a look @ the output of "wmic product list" at the command line. – Alex K. Aug 13 '10 at 13:34
  • Actually I need to determine application location (disk drive) in order to estimate available disk space before installing msp patch. Can I determine location of installed application if I know only guid in HKEY_LOCAL_MACHINE \SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{}? – Yuriy Aug 13 '10 at 14:25
1

The premise of this question is misleading because the UninstallString in the registry is not used when doing the uninstall. Go ahead and change the string to test this - it won't use your altered string.

Although references to stuff in the registry might be appealing, the short answer is that Windows Installer data in the registry is implementation detail. The question is basically asking how MsiConfigureProduct(....INSTALLSTATE_ABSENT...) works, and it's pointless to guess at the implementation details and where it might be in the registry. It's APIs all the way down. There might have been an actual task the poster may have wanted to accomplish, but it is masked by a question of how uninstalls work.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • Definitely agree - it is never acceptable to access MSI database details directly, or even just to try to decode it which many people seem to be doing with stuff they find in the registry. – Stein Åsmul Oct 10 '17 at 21:25