Java Uninstall/Reinstall fixlet

(imported topic written by JElizabeth)

We only recently started using TEM to do patch management, and I’ve run into a problem updating Java on a system that has been customized. When the upgrade from Java 7u21 to 7u25 ran, the fixlet reported success but the install was half-baked (perhaps due to too short of a time constraint) and I had to find a way to fix it remotely. The Java update fixlet was no longer relevant, and even if I changed the relevance and re-deployed it, it always came back as ‘Failed’. I now have a fixlet that uninstalls Java completely that will work on both Windows 8 and Windows 7 x64 machines, but I still need a way to put Java back on the computer. So far, this is the fix I have come up with to install Java remotely:

prefetch jre-7u25-windows-i586.exe sha1:0adf48a414d81d2c7fafe93298644d9e26a5706a size:31714216 
http://download.oracle.com/MANUAL_BES_CACHING_REQUIRED/jre-7u25-windows-i586.exe 
delete __appendfile
appendfile @ECHO OFF
appendfile start /w msiexec /i jre-7u25-windows-i586.exe /qn REBOOT=ReallySuppress
delete installJRE.bat
copy __appendfile installJRE.bat
wait "{pathname of client folder of site "BESSupport"}\RunQuiet.exe" installJRE.bat
action may require restart

When I look at the log files, every piece of this is executed successfully, including starting the Microsoft installer and passing it the Java executable. However, msiexec starts and ends in the same millisecond, and Java is never actually installed. This is only one of many differing attempts, and I’m running out of ideas. Any help in figuring this out would be greatly appreciated.

(imported comment written by sinucus)

We’ve had similar problems with Java and my only solution was to unpackage the JDK and extract out the .msi file located inside it. Below is a copy of our Java 7u25 x64 install.

Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html and select their JDK download. Once downloaded, run the .exe file and DON’T CLICK ANYTHING… Once the installer is opened, navigate to C:\Users%username%\AppData\LocalLow\Sun\Java\jdk1.7.0_25_x64 and find one of the .cab files that has the .msi in it, extract that and you are good to go.


prefetch jre.msi sha1:0d832d170a33b1ff3f991bfdb76d0899348fa528 size:31369728 http://EXAMPLEURL/jre.msi

// Note: update .exe will restart service automatically

if{exists running service “JavaQuickStarterService”}

delete __appendfile

delete stop_javaquickstarter.bat

appendfile net stop JavaQuickStarterService

move __appendfile stop_javaquickstarter.bat

waithidden stop_javaquickstarter.bat

endif

regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\JavaInstallation]” “InstallingJava7_64”=dword:00000001

waithidden msiexec.exe /qn /i __Download\jre.msi

action may require restart “0d832d170a33b1ff3f991bfdb76d0899348fa528”

continue if {((exists value “DisplayVersion” whose ((it = “7” and it >= “7.0.250”) of (it as string as version)) of keys whose ((value “DisplayName” of it as string as lowercase contains “j2se runtime environment” OR value “DisplayName” of it as string as lowercase starts with “java 7”) AND (value “DisplayName” of it as string as lowercase contains “64-bit”)) of it) AND (exists key whose (((it contains “java” OR it contains “j2se”) AND ((it contains “runtime environment” OR it contains “update”)) AND (it contains “64-bit”)) of (value “DisplayName” of it as string as lowercase)) of it)) of key “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall” of x64 registry}

regdelete “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\JavaInstallation]” “InstallingJava7_64”

(imported comment written by JElizabeth)

It worked! Thanks.