cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 9

Remove old versions of Java 8

Jump to solution

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

Labels (1)
0 Kudos
1 Solution
Level 8

To add the uninstall tasks, you just need to edit the specific Java update package, and click on the edit PackageBoot button when you get to the third page of options:

pastedImage_0.png

Once in the editor, add a Run a Program action, and select Uninstall MSI:

pastedImage_1.png

Note that I found out the hard way that if there are any updates to the package once you make these changes, it removes them and you need to modify it again. I think the best way to go is to Duplicate the package first, then publish your version.

View solution in original post

26 Replies
Level 9

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

Level 10

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?

0 Kudos
Level 13

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

0 Kudos
Level 7

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.

pastedImage_1.png

0 Kudos
Level 13

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.

0 Kudos
Level 11

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.

0 Kudos
Level 10

Ok, well I am testing this command line argument first for Java 8 to see it it removes the old java 8 updates, then I have to see if they backported this for java 7.

/s REMOVEOUTOFDATEJRES=1

Installing With a Configuration File

Edit, it works, but it uninstalls every Java, including 7 and 6.  I'll have to see if my EMC Unisphere console works now becuase I'm pretty sure that only works in Java 6 u 45.

Level 9

Good info.  How would you incorporate that into a package then?

0 Kudos
Level 13

You add it in as a task in the packageboot.xml.

The one thing to know about that is it only removes out of date from the security baseline.  The security baseline may leave a version or two previous.  Just so you don't see it not remove the most recently previous version and think it doesn't work.

0 Kudos
Level 11

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

Level 9

I have been trying to modify the Package Boot Editor by adding a "Run a Program" action in the "After applying package" portion of my Java 8u51 package.  I am calling cmd.exe and in the command line parameters, I am entering /c MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F86418045F0} /qn (this is to remove 8u45).  The package keeps failing when deployed by SCCM and the error code I am getting is useless but, if I run that msiexec.exe /x command from the command prompt on any machine, Java 8u45 gets unistalled so I am close to getting this to work.

If anyone else gets it working please share

Level 9

Any luck with this yet?

0 Kudos
Level 13

Editing the packageboot works when you want to remove the previous version when installing the new version.

To remove the old versions I used PSExec, made a txt file of all PCs and then just put in for example 8u25

PsExec.exe @FILE.txt -h -u DOMAIN\ADMIN ACCOUNT MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218025F0} /qn

You can make a batch file with all of them but I just made one command prompt for each version to keep it straight

0 Kudos
Level 11

I didn't even bother with PSExec, I just added 3 new MSI uninstall actions in the PackageBoot editor.

Capture1.JPG

Level 7

Can you just select all computers on your domain?  What happens if a PC doesn't actually have that version of Java installed? 

0 Kudos
Level 13

You can target a task (like an update deployment task) to the whole domain if you'd like.

If you attempt to uninstall a particular MSI Product ID, it looks for that specific MSI Product ID and it will only uninstall it if it matches, so effectively it won't do anything to machines that don't have that version installed.

0 Kudos
Level 13

I cant believe i didnt think of that, thats a great way to do it.  For whatever reason I always just did the 1 previous version.  Man I feel stupid lol

0 Kudos
Level 9

Can you give a little more detail as to how you do this?  I think this is the answer I'm looking for...

0 Kudos
Level 8

To add the uninstall tasks, you just need to edit the specific Java update package, and click on the edit PackageBoot button when you get to the third page of options:

pastedImage_0.png

Once in the editor, add a Run a Program action, and select Uninstall MSI:

pastedImage_1.png

Note that I found out the hard way that if there are any updates to the package once you make these changes, it removes them and you need to modify it again. I think the best way to go is to Duplicate the package first, then publish your version.

View solution in original post

Level 9

Thank you, this looks great!

0 Kudos