Tip: Getting the ProdID for Package / xPackage modules

Hi folks, I’ve seen some people post about how they’re trying to use the Package or xPackage modules to install things. Often (and rightly so) the responses to these questions are along the lines of “It sucks to have to use a product ID, so we typically install it someway else”. Still, for those of us who wanna be stubborn (like me haha), I figured out an easy and somewhat reliable way of getting the product ID you need in order to install via the modules, regardless of whether the source installer was an EXE or was an MSI.

Step 1: Install the product on a test machine. This will ensure that the registry is updated with the info about the product.

Step 2: Download and install the PSMSI module for powershell: http://psmsi.codeplex.com/

Step 3: Find the “uninstaller” file/path for your product. In my example I’m using SQL 2014.

Step 4: Use this information to enumerate the GUID like so :

PS C:\Windows\system32> get-msicomponentinfo | where { $_.Path -eq "C:\Program Files\Microsoft SQL Server\120\Setup Bootstrap\SQLServer2014\x64\SetupARP.exe" } | get-msiproductinfo

ProductCode                            ProductVersion      ProductName                                                                                                                                                             
-----------                            --------------      -----------                                                                                                                                                             
{0EEBDCCA-EF5D-4896-9FEA-D7D410A57E8A} 12.0.2000.8         Microsoft SQL Server 2014 Setup (English)   

(Source = http://psmsi.codeplex.com/wikipage?title=Examples.Components&referringTitle=Examples)

Step 5: Profit! Add this GUID as your product ID, you’re good to go!

Bonus: I know that the GUID does exist in the registry and you can find it there (under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall), however SQL is a perfect example of "This is an installer that installs multiple MSI’s and identifying which exact one is the ‘right one’ can be difficult. This sort of just makes it easy to spot.

Happy I could contribute something for once! :slight_smile:

Thanks for posting Ryan! Next time can you post a couple weeks earlier? :wink: I just had to do this about twenty times using regedit, getting my DSC document ready for FIM.

Hehe I only figured it out within the last 24 hours! Sorry couldn’t help sooner, but it’ll be good for the future! :slight_smile: