Installing executables with Powershell DSC Installing executables with Powershell DSC powershell powershell

Installing executables with Powershell DSC


If you have a system where the software was already installed you can find the ProductID using:

Get-WmiObject -Class Win32_Product | fl Name,Version,InstallDate,InstallSource,PackageName,IdentifyingNumber

Example output:

Name              : Dell OpenManage Systems Management Software (64-Bit)Version           : 7.3.0InstallDate       : 20131009InstallSource     : c:\Installs\OMSA\PackageName       : SysMgmtx64.msiIdentifyingNumber : {7CB08DC5-EA02-4076-BA7D-AD7736A3DE71}Name              : Microsoft ASP.NET MVC 4 RuntimeVersion           : 4.0.40804.0InstallDate       : 20141111InstallSource     : C:\windows\TEMP\IXP000.TMP\PackageName       : AspNetMVC4.msiIdentifyingNumber : {3FE312D5-B862-40CE-8E4E-A6D8ABF62736}

Where IdentifyingNumber is the GUID you should use in the package resource. Example for the above Dell software:

package OMSA{        Name = 'Dell OpenManage Systems Management Software (64-Bit)'        ...        ProductId = '7CB08DC5-EA02-4076-BA7D-AD7736A3DE71'        Arguments = ...}


Quoting Heath Stewart's comment:

the ProductId is the ProductCode of the MSI, which you can get by opening the MSI in Orca (part of the Windows SDK) or you can install my module from http://psmsi.codeplex.com and get it like so:

get-msitable <yourmsi.msi> -table Property | where { $_.Property -eq "ProductCode" }


The error means you have a mismatch in the Name or the ProductId of your Package resource against the msi content.

Easiest way in my experience to find both value is to use the Carbon powershell module.

Install-Module Carbon

Then simply run from powershell console:

msi "[path to your msi]"

Note: msi is an alias for Get-Msi

Example:

PS C:\Users\gigi\Downloads> msi .\node-v6.10.0-x64.msiProductName ProductVersion Manufacturer       ProductCode                         ----------- -------------- ------------       -----------                         Node.js     6.10.0         Node.js Foundation 84f68739-3b44-4d36-abdb-2151a23c9c3d

Copy and paste ProductName and ProductCode to your DSC package configuration and you are done.