PowerShell DSC: Get Product IDs of Installed Products

The PowerShell DSC Package resource requires a ProductId and the exact product name.

If you aren’t sure what product id or product name associated with the software you wish to install, you can try this method:

  1. Install the software manually on a similar target machine
  2. Open a PowerShell command prompt or the PowerShell ISE
  3. Run the following command:
            Get-WmiObject Win32_Product

This command lists most of the installed software on the system. Find your target and record the ProductId and Name. They will need to match your DSC configuration exactly. Next, in your PowerShell DSC configuration, update the Package resource with the values you’ve discovered, e.g.

Package InstallSomeSoftware
  Ensure = "Present"  
  Path  = "D:\DSC\SomeSoftware_v4.4.msi"
  Name = "Some Software"
  ProductId = "ad9b6775-28d2-4ef4-b2e3-58941ea51c26"
  Arguments = "/qn"
  DependsOn = "[Script]DownloadSomeSoftware"

Also note that the Arguments should be whatever your software package requires to run a “silent install.”

Hope this helps!

This entry was posted in PowerShell, PowerShell DSC. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *