Peter McEvoy Peter McEvoy - 3 months ago 47
PowerShell Question

Installing JRE using Powershell DSC hangs

I'm trying to remote install Java Runtime (8 as it happens) using Powershell DSC on a Windows 2012 R2 box, but it appears to be hanging.

I initially tried to install it using a Chocolatey DSC provider, but that gave me a false success (choco claimed it was installed, but no actual files were unpacked). I chalked this fact up to this: http://powershell.org/wp/forums/topic/issue-installing-java-32-bit-using-package-resource/#post-23187

So I unpacked the exe and extracted the two java MSIs and my DSC configuration looks like this:

Package java8x86
{
Ensure = 'Present'
Name = 'Java 8 Update 45'
Path = (Join-Path $localDscFileDir "Java\jre1.8.0_45\jre1.8.0_45.msi")
Arguments = '/s'
ProductId = '26A24AE4-039D-4CA4-87B4-2F83218045F0'
DependsOn = @("[File]javaMsi")
}


([File]javaMsi copies the .msi files to the remote machine).

When I generate my MOF and Start-DscConfiguration, the output hangs on these lines:

VERBOSE: [DEVTEST-3U2LN5Q]: [[Package]java8x86] Parsing 26A24AE4-039D-4CA4-87B4-2F83218045F0 as an identifyingNumber
VERBOSE: [DEVTEST-3U2LN5Q]: [[Package]java8x86] Parsed 26A24AE4-039D-4CA4-87B4-2F83218045F0 as {26A24AE4-039D-4CA4-87B4-2F83218045F0}
VERBOSE: [DEVTEST-3U2LN5Q]: [[Package]java8x86] Package configuration starting
VERBOSE: [DEVTEST-3U2LN5Q]: [[Package]java8x86] Starting C:\Windows\system32\msiexec.exe with /i "C:\DscFiles\Java\jre1.8.0_45\jre1.8.0_45.msi" /quiet /s
VERBOSE: [DEVTEST-3U2LN5Q]: [[Package]java8x86] Starting process C:\Windows\system32\msiexec.exe with arguments /i "C:\DscFiles\Java\jre1.8.0_45\jre1.8.0_45.msi" /quiet /s


I can't even CTRL-C out of that and have to go to the remote machine and kill the Windows Installer process to cause the Start-DscConfiguration to fail

I'm getting to wits end.... it's 2015 and I can't remote setup a Windows box! So much promised by these technologies....

Answer

A year later and I seem to have a solution. Not sure if the original problem was to do with the version of the installer I was installing or not.. but this seems to work for me - for now:

    xRemoteFile javaInstaller {
        DestinationPath = (Join-Path $localDscFileDir "Java\jreInstaller.exe")
        Uri = "http://javadl.oracle.com/webapps/download/AutoDL?BundleId=211999"
    }
    Package java8
    {
        Ensure = 'Present'
        Name = 'Java 8'
        Path = (Join-Path $localDscFileDir "Java\jreInstaller.exe")
        Arguments = '/s REBOOT=0 SPONSORS=0 REMOVEOUTOFDATEJRES=1 INSTALL_SILENT=1 AUTO_UPDATE=0 EULA=0 /l*v "C:\DscFiles\Java\jreInstaller.exe.log"' #From https://powershell.org/forums/topic/issue-installing-java-32-bit-using-package-resource/#post-39206
        ProductId = '26A24AE4-039D-4CA4-87B4-2F64180101F0'
        DependsOn = @("[xRemoteFile]javaInstaller")         
    }

BTW, that download url corresponds to jre-8u101-windows-x64.exe