Multiple Versions of Java JRE Uninstall

(imported topic written by tswong91)

Need some assistance on action solution.

I need an action to UNINSTALL multiple versions of Java JRE within the environment leaving EXCEPT the CurrentVersion is shown in “HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment”

I have the following based on a BigFix solution given but it only looks for 1.4.2, I tried substituing the

http://>= 1.4.2

with a but it didn’t create a bat file at all:

delete __appendfile

appendfile @ECHO OFF

appendfile {concatenation “%0d%0a” of (“start /w msiexec /x” & name of it & " /qn REBOOT=ReallySuppress") of keys whose ((it contains “se runtime environment” OR it contains “java 2 runtime environment”) of (value “DisplayName” of it as string as lowercase) AND value “DisplayVersion” of it as string as version >= “1.4.2” AND (numeric value of (if length of it = 3 then it & “000” else if length of it = 4 then it &“00” else it) of concatenation of substrings separated by "

" of concatenation of substrings separated by “.” of (value “DisplayVersion” of it as string)) < (maximum of (numeric values of (if length of it = 3 then it & “000” else if length of it = 4 then it & “00” else it) of concatenation of substrings separated by "

" of concatenation of substrings separated by “.” of (value “DisplayVersion” of it as string)) of keys whose ((it contains “se runtime environment” OR it contains “java 2 runtime environment”) of (value “DisplayName” of it as string as lowercase) AND value “DisplayVersion” of it as string as version >= “1.4.2”) of key “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall” of registry)) of key “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall” of registry}

delete uninstallJRE.bat

copy __appendfile uninstallJRE.bat

(imported comment written by B7TN_Pete_Ladesic)

tswong,

Im working on the same type of situation and was wondering if you ever finished customizing the fixlet Bigfix supplied to remove ALL versions EXCEPT the current version.

Look forward to hearing from

(imported comment written by BenKus)

Hey tswong,

Registry values won’t compare properly unless you cast them like this:

(value “CurrentVersion” of key “HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment” of registry +as string as version+)

So you can try this:

concatenation “%0d%0a” of (“start /w msiexec /x” & name of it & " /qn REBOOT=ReallySuppress") of keys whose ((it contains “se runtime environment” OR it contains “java 2 runtime environment”) of (value “DisplayName” of it as string as lowercase) AND value “DisplayVersion” of it as string as version != (value “CurrentVersion” of key “HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment” of registry as string as version) AND (numeric value of (if length of it = 3 then it & “000” else if length of it = 4 then it &“00” else it) of concatenation of substrings separated by “” of concatenation of substrings separated by “.” of (value “DisplayVersion” of it as string)) < (maximum of (numeric values of (if length of it = 3 then it & “000” else if length of it = 4 then it & “00” else it) of concatenation of substrings separated by “” of concatenation of substrings separated by “.” of (value “DisplayVersion” of it as string)) of keys whose ((it contains “se runtime environment” OR it contains “java 2 runtime environment”) of (value “DisplayName” of it as string as lowercase) AND value “DisplayVersion” of it as string as version != (value “CurrentVersion” of key “HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment” of registry as string as version)) of key “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall” of registry)) of key “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall” of registry

I have no idea if that will work properly, but you can try it…

Ben