Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing an exe with Powershell DSC Package resource gets return code 1619

I'm trying to use Powershell DSC's Package resource to install an exe... Perforce's P4V to be specific. Here's my code:

Configuration PerforceMachine
{
    Node "SERVERNAME"
    {
        Package P4V
        {
            Ensure = "Present"
            Name = "Perforce Visual Components"
            Path = "\\nas\share\p4vinst64.exe"
            ProductId = ''
            Arguments = "/S /V/qn" # args for silent mode
            LogPath = "$env:ProgramData\p4v_install.log"
        }
    }
}

When running this, this is the error Powershell gives me:

PowerShell provider MSFT_PackageResource failed to execute Set-TargetResource functionality with error message: The return code 1619 was not expected. Configuration is likely not
correct
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : SERVERNAME

According to documentation, return code 1619 means the MSI package couldn't be opened. However, when I manually log in to the machine and run "\\nas\share\p4vinst64.exe /S /V/qn", the install works flawlessly.

Does anyone know why this is failing? Alternately, can anyone tell me how to troubleshoot this? I pasted all the error information I got from the terminal, my log file (p4v_install.log) is a 0 byte file, and there are no events in the event viewer. I don't know how to troubleshoot it any further!

EDIT: I should note that I also tried using the File resource to copy the file locally, and then install it from there. Sadly, that met with the same result.

like image 364
Jay Spang Avatar asked Jun 02 '14 22:06

Jay Spang


2 Answers

Daniel over at the Powershell.org forums was able to figure this out for me.

The P4V InstallShield setup wrapper puts the MSI file into wrong path if you execute as LocalSystem.

I’ve managed to develop a Configuration that works, see below. The key is the /b switch here which puts the MSI file into a defined location. I’ve added ALLUSERS=1 to get the shortcuts visible to all users and REBOOT=ReallySuppress to avoid a sudden restart (which will happen otherwise).

Configuration PerforceMachine
{
    Package P4V
    {
        Ensure = "Present"
        Name = "Perforce Visual Components"
        Path = "C:\My\p4vinst64.exe"
        ProductId = ''
        Arguments = '/b"C:\Windows\Temp\PerforceClient" /S /V"/qn ALLUSERS=1 REBOOT=ReallySuppress"' # args for silent mode
    }
} 
like image 62
Jay Spang Avatar answered Nov 20 '22 16:11

Jay Spang


Well, what happens here is that the package gets installed (not tested with p4vinst64.exe yet! So, not sure why it says pack cannot be opened as the error) but since you did not specify a ProductID value, the verification at the end of install fails. That is the error you are seeing. The Package resource is no good for installing .exe packages or even MSIs with no ProductID represented as a GUID.

You can use the WindowsProcess resource instead.

like image 24
ravikanth Avatar answered Nov 20 '22 16:11

ravikanth