Removing old Java versions

Hello All,

I am tasked with removing old versions of Java.

The latest fixlett in BF looks to be only able to remove a version back.

So using Inventory I have found the Java software registry entries (Java7 Update 25), that generally look something like this
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{26A24AE4-039D-4CA4-87B4-2F83217025FF}

I have been trying to find a specific registry entry (like above) and the action a msiexec /x on it

But I have not been sucessfull. I have reseached over the last week trying varouse methods but cannot find one that works.

if {exists key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{26A24AE4-039D-4CA4-87B4-2F83217025FF}” of registry}
waithidden MsiExec.exe /x {{26A24AE4-039D-4CA4-87B4-2F83217025FF} /passive
endif

Can anyone point me in the right direction. Going back to my programing days, there seems not to be able to set breakpoints and inspect items as they are passed, so hard to find how I can get moving forward.

Any and all help much apprecated.
Paul

1 Like

Below is the relevance and action we’ve used successfully to remove java below a specified version:

Relevance:

exists keys whose (value "DisplayName" of it as string as lowercase contains "java" AND (value "Publisher" of it as string as lowercase contains "oracle" OR value "Publisher" of it as string as lowercase contains "sun") AND value "DisplayName" of it as string as lowercase does not contain "java auto updater" AND value "DisplayVersion" of it as string as version < "8.0.2010.0") of keys "hklm\software\microsoft\windows\currentversion\uninstall" of (x64 registries;x32 registries)

Action to uninstall Java less than version specified:

delete __appendfile

appendfile @ECHO OFF
appendfile {concatenation "%0d%0a" of ("start /w msiexec /x" & name of it & " /qn REBOOT=ReallySuppress") of keys whose (value "DisplayName" of it as string as lowercase contains "java" AND (value "Publisher" of it as string as lowercase contains "oracle" OR value "Publisher" of it as string as lowercase contains "sun") AND value "DisplayName" of it as string as lowercase does not contain "java auto updater" AND value "DisplayVersion" of it as string as version < "8.0.2010.0") of keys "hklm\software\microsoft\windows\currentversion\uninstall" of (x64 registries;x32 registries)}

delete c:\windows\temp\uninstallJava.bat
copy __appendfile c:\windows\temp\uninstallJava.bat

wait c:\windows\temp\uninstallJava.bat
2 Likes

Great, Thanks dakota.
The info and details is much appreciated.
Many Thanks
Paul