How does the MSI Registration ProductID look like and where to find it?

Written by Alex Marin · November 18th, 2020

#MSI #TIPS

Ever wonder how an MSI registration ProductID is created?
When installing an MSI, it registers on the system with a "strange" ProductID (different from regular ProductIDs) which is sometimes tricky to find. This is particularly challenging when you're trying to locate the package installer by its ProductID.

To make things more straightforward - I will be sharing the different locations where the information (including the PackageID) about your MSI package is stored. By the end of it, you will find a helpful script to find your package's ProductID faster.

Where is the information about the MSI package stored?

When an MSI package is installed, the most common location for storing information about it is:

For For 32bit apps:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\

For For 64bit apps:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

Shown in the Add/Remove Programs section, you will find all the details related to MSI, such as:

  • Product Name
  • Product Version
  • Publisher
  • Information about where it was installed from
  • Uninstall string, etc.

It's important to note that when an MSI is registered on the machine, there's additional information that gets stored in a different location:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\.

In this registry, you will find extra settings like AuthorizedLUAApp, Language, SourceList, etc.

If you have an MSI which has a display name present in the uninstall registry, and a different one in the Add/Remove Programs -- take note that the display name seen in Add/Remove Programs came from:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\

How to find the ProductID

When we have a closer look into HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\, the information found there doesn't look like Product Codes - you will not find that string in your MSI.

So what does that information represent?

It turns out that even if it doesn't look like it, it is in fact the Product Code, but with a slight change.

The way this ProductID is stored into HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\ is:

  • First 8 digits are reversed
  • Next 4 digits are reversed
  • Next 4 digits are reversed
  • The next 16 digits are reversed two by two

For example, let’s take the following MSI Product Code: {6732E1E0-6629-4B92-A25F-40377D162D15}.

This will be placed in Classes\Installer as 0E1E2376926629B42AF50473D761D251.

This key is not dynamic on each machine, it remains the same in every device where you install the MSI. But, what if we need something more dynamic?

To do that, you can use the following VBScript that returns the GUID based on the ProductCode. The code is as follows:

Function ProdReg (ProductCode)
 
arr = Split(ProductCode,"-")
arr1 = rev(arr(0))
arr2 = rev(arr(1))
arr3 = rev(arr(2))
arr4 = revby2(arr(3))
arr5 = revby2(arr(4))
 
prodreg = arr1&arr2&arr3&arr4&arr5
End Function
 
Function rev(s)
Dim p
For p = Len(s) To 1 Step -1
rev = rev & Mid(s, p, 1)
Next
End Function
 
Function revby2(str)
for x=1 to len(str)-1 step 2
v = rev(Mid(str,x,2))
revby2 = revby2 & v
next
End Function

Conclusion

As mentioned above, you might want to use the above script for an easier way to find the right ProductID.

This is helpful in some scenarios, for example when you have a master SharePoint in your infrastructure. In that kind of situation, you can add the script in the MSI to alter the ProductID registry, and during the repair, the MSI will first search on the machine for the sources.

If Windows Installer doesn’t find them, it will jump to the alternative location written in the registry (for example, the above mentioned Sharepoint).

NoteThis script can also be used for recaching transform files as described in this article.

Found this article helpful? Let us know in the comments and don't hesitate to share some other tips.

Subscribe to Our Newsletter

Sign up for free and be the first to receive the latest news, videos, exclusive How-Tos, and guides from Advanced Installer.

Comments: