How to find the ProductCode GUID of an installed MSI

Written by Horatiu Vladasel · June 23rd, 2022

#MSI

A ProductCode is made up of string GUIDs containing numbers and uppercase letters.

Since this code is specific to each Windows Installer package, you can't install two software products with the same ProductCode on the same machine – if that happens, you will get the following error message:

Software Already Installer Error

In this article, we will show you a few ways to find your ProductCode whenever you need it. Let's start with the ProductCode Property within the MSI.

How to find the ProductCode Property within the MSI

If you have access to the MSI, then probably the easiest way to find the ProductCode is by opening an MSI editor tool and heading to the Property table.

There, you will find the ProductCode property, which gives you the unique identifier of that Windows Installer package.

ProductCode Property

How to find the ProductCode using Uninstall Registry keys

We also have the option to find the ProductCode of a software product by going to the Uninstall Registry keys and searching for it. It may not be the most simple thing, so let's see how we can achieve that.

Uninstall Registry Keys

The Uninstall Registry keys could be located under one of the following registry hives:

x64 bit installer, per-machine based installation

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

x86 bit installer, per-machine based installation

HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall

x64 bit installer, per-user based installation

HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 

x86 bit installer, per-user based installation

HKCU\SOFTWARE\ WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall

You will find the details of the software product stored in a subkey of the above registry hives – identified by the ProductCode.

Finding the ProductCode with VBScript

WiLstPrd.vbs is a VBScript file provided in the Windows SDK Components for Windows Installer Developers.

It uses an Installer object to retrieve the registered products and product information on the local device.

WiLstPrd.vbs Script

To retrieve the ProductCode of a specific software product, you need to run the following command line from a command prompt:

cscript "WiLstPrd.vbs" <ProductName> | findstr ProductCode
Retrieve ProductCode with VBScript

How to Use PowerShell to Find the ProductCode?

All Windows Installer packages, and their related information, can be accessed through Windows Management Instrumentation (WMI)’s Win32_Product class via PowerShell.

Win32_Product

In the example above, we formatted the output as a table with the selected properties of the object in each column:

  • IdentifyingNumber – represents the ProductCode
  • Name – represents the ProductName

To retrieve the ProductCode of a specific software, you need to run the following command:

Get-WmiObject Win32_Product | Where Name -eq '<ProductName>' |Format-Table IdentifyingNumber, Name
Retrieve ProductCode Using Powershell

NoteBoth VBScript and PowerShell commands should be executed with administrative permissions.

TipMaster all you need to know about MSI with the MSI Packaging Training eBook. Haven't read it yet? Grab your free copy now.

Conclusion

And there you go! Now you have a few options to find the ProductCode GUID of your installed MSI setup whenever you need it.

We hope you found this article useful! Let us know if you have any questions.

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: