Installing executables with Powershell DSC

Viewed 5681

I am trying to install Visual Studio 2013 using PowerShell DSC but I'm running into a few issues and hoping that you guys could clear it up for me. Is DSC capable for rebooting the node and then resuming an installation of VS? Does anyone know what this error means? "vs_ultimate.exe was installed, but the specified ProductId and/or Name does not match package details"

Does anyone have any more specific examples of trying to install .exe with this method?

How does someone find out the ProductID?

Does anyone know the exact syntax of the ReturnCode?

Any help would be great!

4 Answers

I wrote a PowerShell function to find the product information

Function Get-InstallerProductProperty
{
    # Define parameters
    Param($installerFilePath,
    $PropertyName)

    # Verify file exists
    if((Test-Path -Path $installerFilePath) -eq $true)
    {
        $path = $installerFilePath

        $comObjWI = New-Object -ComObject WindowsInstaller.Installer
        $MSIDatabase = $comObjWI.GetType().InvokeMember("OpenDatabase","InvokeMethod",$Null,$comObjWI,@($Path,0))
        $Query = "SELECT Value FROM Property WHERE Property = '$PropertyName'"
        $results = $View = $MSIDatabase.GetType().InvokeMember("OpenView","InvokeMethod",$null,$MSIDatabase,($Query))
        $View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null)
        $Record = $View.GetType().InvokeMember("Fetch","InvokeMethod",$null,$View,$null)
        $Value = $Record.GetType().InvokeMember("StringData","GetProperty",$null,$Record,1)

        # Return the product id
        return $Value.Replace("{", "").Replace("}", "")
    }
}
Related