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}
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.
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…