In my last post about silent / unattended installation of Java 8 Update 66, we followed the new guidelines for how to install Java 8 silently by Oracle. The problem with that method is that it works when you try to run your script locally with administrator privileges it will work fine, but when you run the same script through SCCM / Configuration Manager, it will fail. And just to confuse you even more, it will only fail for the 32-bit version of java, not the 64-bit, even though you use the exact same method. This problem have been reported in some bug reports, here, here and here.

So what’s the solution?

First, you have to revert to the “old” solution of extracting the MSI package from the Java installer. Find the newest version of Java offline installer from here. Remember that you properly need a 32-bit version, since Java 64-bit can only run in a 64-bit browser, and very few have that. Open the exe file, and just let it stay on the splash screen, then navigate to the following folder where the MSI file are placed:
C:\Users\[username]\AppData\LocalLow\Oracle\Java

Then select the folder for the version you’re installing, i.e. jre1.8.0_72:
C:\Users\[username]\AppData\LocalLow\Oracle\Java\jre1.8.0_72

Now we can install by adding a few flags to the commandline of the MSI file, like this:

start /wait msiexec.exe /i “jre1.8.0_72.msi” /qn JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 RebootYesNo=No

Remember to configure your new application in SCCM to supersede the old version of java, so they will get uninstalled first.

Now, Java is a bit special, as you might have figured out from the exe file unpacking a MSI file. But it doesn’t stop there, the MSI file actually unpacks a new exe file, and that’s causing problem with the detection method in SCCM. Because if you run the script only with the above line, the process will be over in a few seconds, and then SCCM will start to check with your preferred detection method, and it will find nothing to be installed and give an error about installation have failed. And then when you check on the target computer in “Programs and Features” you’ll see a Java 8 Update 72 to be installed. So how do we solve that? We put in a slight delay so SCCM still thinks the installation is running, by having this line:

ping 127.0.0.1 -n 120 > nul

The above command pings the localhost for 120 seconds, and don’t write anything to the screen. You can make it wait longer if the client is slow. Below is the full script:

start /wait msiexec.exe /i “jre1.8.0_72.msi” /qn JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 RebootYesNo=No 
ping 127.0.0.1 -n 120 > nul