26 Replies Latest reply on Nov 15, 2016 10:44 AM by antwesor

    Remove old versions of Java 8

    dkunkle84

           Is there anyone out there that has a good solution to removing the old version of Java 8 now that they don't get removed when a new version is installed?  My test machine has about 4 old versions of java now...

        • Re: Remove old versions of Java 8
          frgpugs

          For new installs I edit the package before I publish it to include running another MSI and running the uninstall string for the old Java.  To clear out all the old ones I found PsExec easiest using the following string.  Youll need a list of all PCs you want to run it on saved to a txt file

           

          PsExec.exe @(DOCUMENT.TXT) -h -u (DOMAIN-NTFS STYLE)\(ADMIN ACCOUNT) MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218025F0} /qn

           

          The previous string is for Java 8u25.  Just change the last part before F0 to the version you want to remove, IE 2F83218031F0 would be for Java 8u31

            • Re: Remove old versions of Java 8
              dkunkle84

              That seems like a lot especially if I'm trying to get it removed from all computers on my domain.  What changed that the old versions don't get removed anymore?  I can understand going from 7 to 8, but now all minor revisions don't get uninstalled?  That is definitely different from 7.

                • Re: Remove old versions of Java 8
                  frgpugs

                  It definitely is a departure from the norm and extremely frustrating.  I have no idea why Java is doing this, especially since if you run the installer from the web it will remove old versions.  Honestly once you get up to date removing the old ones its not that bad to edit the package to run the msi uninstaller for the previous version, its just getting to the point that all the old ones are gone thats the pain.

                   

                  Just an idea, get a list of all PCs from AD and use that as your txt file with psexec.  If it has Java it will remove it and if it doesnt have it then it will just time out and move on to the next pc so you dont have to know each pc with java on it.

                  • Re: Remove old versions of Java 8
                    kellytice

                    Just a side note here:  If there is a particular version of Java that you wish to uninstall from the whole domain, you can do that with a task in Patch Manager.

                     

                    • Find a machine that has the specific version you wish to uninstall
                    • In Patch Manager, select and right-click that machine, then launch Computer Explorer and go to the Installed Software tab.
                    • Select the specific .MSI-based software you wish to uninstall and click "Uninstall" on the upper right.
                    • On the computer selection page, the one machine will be targeted, but add other machines using the "Add machines" or "Browse Machines" options, or you can click the "Select Computers using Rules" option to scope it out to a larger group (patching group / OU / domain)
                    • On the page after, you can determine to run that task now or schedule the uninstall for a certain time.


                    Note:  this just works for .MSI-based applications, it would not be an available option for .EXE-based apps.

                • Re: Remove old versions of Java 8
                  jbaits

                  I have a pre-install task in package boot that removes all instances of Java 8 of the same architecture as the version being installed. The worst case scenario is the uninstall succeeds and the install fails leaving the user with no Java until the update is run again and succeeds. I find this preferable to leaving behind old and vulnerable java installs. I've listed the relevant commands below.

                   

                  Target 32 bit install: wmic product where "name like 'Java 8%%' AND NOT name like '%%(64-bit)'" call uninstall /nointeractive

                  Target 64 bit install: wmic product where "name like 'Java 8%%' AND name like '%%(64-bit)'" call uninstall /nointeractive

                   

                  in package boot you would need to call cmd.exe then for parameters include /c followed by the desired removal command.

                  Example: /c wmic product where "name like 'Java 8%%' AND NOT name like '%%(64-bit)'" call uninstall /nointeractive

                  • Re: Remove old versions of Java 8
                    dkunkle84

                    Here's what I did for the latest 8u60 java to uninstall 8u51 from our computers.  I set it to move on even if the uninstall fails as to not hold up and new patch, and put the 1605 as a success code in, in case the computer does not have that version installed it won't matter.

                    java 8u60.PNG

                      • Re: Remove old versions of Java 8
                        kjstech

                        Hi, is there a table somewhere that lists Product code for every single Java 6, 7 and 8 update?  Like now we are on Java 8 update 101, but whats the code for the 100 other java 8 updates?  So I have to do this over 100 times just to ensure java 8 is up to date, and when update 102, 103, 104, etc.. comes out keep adding more hex codes for them?

                          • Re: Remove old versions of Java 8
                            jbaits

                            I don't know that there is a maintained list of all the GUIDs for the various Java versions. As an alternative you can use the solution I posted above which can remove all versions of Java before installing the latest.

                            • Re: Remove old versions of Java 8
                              frgpugs

                              If you decide to use the GUID you would only need the one you are uninstalling.  If the new Java task installs then it also uninstalls the previous and you should be fine.  The base of the GUID stays the same for each major version, only the end changes and its very predictable.

                               

                              For instance

                              26A24AE4-039D-4CA4-87B4-2F86418045F0  is the GUID for 8u45

                              26A24AE4-039D-4CA4-87B4-2F8641 [8045] F0  the end where the 8045 is determines the version and it just changes the last numbers

                              26A24AE4-039D-4CA4-87B4-2F8641 [8093] F0 is 8u93

                               

                              The only thing I'm not sure about is if Java 8u100+, such as 8u101 will be 80101F0 or 8101F0.  I believe its going to be 8101F0, but you can double check the registry for HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall

                                • Re: Remove old versions of Java 8
                                  robotronik

                                  Hey All, I'm struggling to make the "uninstall MSI" element of the package work. The update installs okay but doesn't uninstall any old versions. I have the correct product codes for the versions I have out on my PCs.

                                  It seems to totally ignore the uninstall elements part during install. Anyone any ideas please or have more specific details on how to use the /s REMOVEOUTOFDATEJRES=1 as I can't get that to work either!?

                                  Many thanks.

                                   

                                   

                                   

                                    • Re: Remove old versions of Java 8
                                      frgpugs

                                      The removeoutofdatejres is added in the Apply Package run jre-8u112-windows-i586.exe under command line parameters.

                                       

                                      Like I said earlier though, it only removes versions outside of the security baseline so if you have 8u101 or 8u102 it will probably leave those installed as they are still in whatever Oracle has determined is the security baseline version.  If you have 8u101 and 8u91 and 7u55 it would likely remove 8u91, 7u55, and then you would have installed 8u112 and 8u101.  The next update that comes out when you input the removeoutofdatejres might then remove 8u101 and leave 8u112 and whatever the new version is.