Obtaining DSC Package Resource ProductID

The PowerShell DSC Package resource can be used to install (and uninstall) software from a machine using DSC. This is a great resource to get software installed, but it does have a slight complication, in that it requires a product ID for the package you are installing. It’s understandable why, it uses this to confirm that the particular version of the software is present, but it can be a pain to get this ID.

Package applicationInstall { 
    Ensure = "Present" 
    Name = "Application Name" 
    Path = "c:\packages\application.msi" 
    Arguments = "/qn /L*v c:\packages\applicaiton.log" ProductId = "AAAA9999-9999-999-99AA-999999AAAAAAA" 

Obtaining ProductID from the MSI

It is possible to get the product ID from the MSI without installing it, but it’s not straight forward. You need to use the ORCA tool from the Windows SDK. Once you have this installed you can look in the property table to find the Product Code field for the product ID.


Obtaining ProductID from an Installed Product

An easier approach that does not require any SDK install would be to use PowerShella and WMI to obtain the details of installed applications.
The following line of code will list all products installed, including their name and IdentifyingNumber, which is the same as the ProductID


Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, Version


Obviously you can filter and layout this data how you wish, or output to a file for searching.