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...
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:
Once in the editor, add a Run a Program action, and select Uninstall MSI:
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.
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
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.
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.
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
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.
Note: this just works for .MSI-based applications, it would not be an available option for .EXE-based apps.
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
*edit*
forgot to say you should run Uninstall MSI and not run a program
you need to remove the switches so its just {26A24AE4-039D-4CA4-87B4-2F86418045F0}
It already knows its uninstalling and the /qn is default on all commands
Any luck with this yet?
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
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.
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?
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.
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.
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
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.
I have been using kellytice's method for removing Java in our environment. There are only 26 to 30 computers that still have Java installed.