Deploying Java can be a real pain! While using this Java Deployment Guide, we recently ran into an issue where an updated version of Java would not install through Group Policy. What we needed was an automated way to uninstall Java regardless of the version.
A quick search of Google turned up numerous results with the same issue. We found that we were able to correct the issue with JavaRa when ran manually. To have three people download and run JavaRa on 1500 workstations was out of the question though. I knew there had to be a way to fix it and I was fortunate enough to find a script which automated the removal process for any Java version. The script can be found at the very bottom of this article.
This script solved the problem of getting the old version of Java off of the computer. Because the policy had already applied though, machines were still not installing the new version of Java. That was quickly remedied by adding the following line onto the batch file.
“\\server\software\jre1.7.0_25\jre1.7.0_25.msi” /passive /norestart
As a note, you can also remove the stuck Application GPO by using the tool MSIManger. That tool can be found under the Active Directory/Group Policy section on this page.
This left one final obstacle, how do I get this file to run on the computers that need it without the necessity of my staff going around to log in to each one individually? We decided to use a startup script that we distributed to all of our computers. This also meant we had to add one final line to the startup script so the machine would automatically reboot once the java install was complete.
shutdown /r /t 0
We have since deployed Java 7 Update 40 and haven’t had any additional errors.
:: Sun / Oracle Java Runtime Environment (JRE) Uninstallation Script :: Created by C:Amie http://camie.dyndns.org/ REM JRE Runtime Environment 7.0 Update 25 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217025FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 25 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417025FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 24 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217024FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 24 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417024FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 23 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217023FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 23 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417023FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 22 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217022FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 22 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417022FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 21 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217021FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 21 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417021FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 20 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217020FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 20 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417020FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 19 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217019FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 19 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417019FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 18 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217018FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 18 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417018FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 17 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217017FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 17 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417017FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 16 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217016FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 16 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417016FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 15 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217015FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 15 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417015FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 14 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217014FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 14 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417014FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 13 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217013FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 13 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417013FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 12 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217012FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 12 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417012FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 11 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217011FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 11 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417011FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 REM JRE Runtime Environment 7.0 Update 10 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217010FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 10 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417010FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217009FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 9 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417009FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 8 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217008FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 8 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417008FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 7 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217007FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 7 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417007FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 6 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417006FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 6 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217006FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 5 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417005FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 5 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217005FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 4 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417004FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 4 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217004FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 3 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417003FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 3 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217003FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 2 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417002FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 2 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217002FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 1 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417001FF} /passive /norestart REM JRE Runtime Environment 7.0 Update 1 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217001FF} /passive /norestart REM JRE Runtime Environment 7.0 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86417000FF} /passive /norestart REM JRE Runtime Environment 7.0 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83217000FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 51 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416051FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 51 (x86) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216051FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 45 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416045FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 45 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216045FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 44 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416044FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 44 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216044FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 43 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416043FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 43 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216043FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 42 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416042FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 42 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216042FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 41 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416041FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 41 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216041FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 40 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416040FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 40 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216040FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 39 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416039FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 39 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216039FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 38 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416038FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 38 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216038FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 37 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416037FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 37 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216037FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 36 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416036FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 36 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216036FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 35 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416035FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 35 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216035FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 34 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416034FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 34 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216034FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 33 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416033FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 33 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216033FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 32 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416032FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 32 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216032FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 31 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416031FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 31 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216031FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 30 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416030FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 30 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216030FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 29 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416029FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 29 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216029FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 28 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416028FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 28 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216028FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 27 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416027FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 27 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216027FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 26 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416026FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 26 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216026FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 25 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416025FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 25 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216025FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 24 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416024FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 24 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216024FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 23 (x64) MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F86416023FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 23 MsiExec.exe /uninstall {26A24AE4-039D-4CA4-87B4-2F83216023FF} /passive /norestart REM JRE Runtime Environment 6.0 Update 22 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160220} /passive /norestart REM JRE Runtime Environment 6.0 Update 21 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160210} /passive /norestart REM JRE Runtime Environment 6.0 Update 20 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160200} /passive /norestart REM JRE Runtime Environment 6.0 Update 19 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160190} /passive /norestart REM JRE Runtime Environment 6.0 Update 18 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160180} /passive /norestart REM JRE Runtime Environment 6.0 Update 17 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160170} /passive /norestart REM JRE Runtime Environment 6.0 Update 16 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160160} /passive /norestart REM JRE Runtime Environment 6.0 Update 15 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160150} /passive /norestart REM JRE Runtime Environment 6.0 Update 14 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160140} /passive /norestart REM JRE Runtime Environment 6.0 Update 13 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160130} /passive /norestart REM JRE Runtime Environment 6.0 Update 12 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160120} /passive /norestart REM JRE Runtime Environment 6.0 Update 11 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160110} /passive /norestart REM JRE Runtime Environment 6.0 Update 10 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160100} /passive /norestart REM JRE Runtime Environment 6.0 Update 9 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160090} /passive /norestart REM JRE Runtime Environment 6.0 Update 8 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160080} /passive /norestart REM JRE Runtime Environment 6.0 Update 7 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160070} /passive /norestart REM JRE Runtime Environment 6.0 Update 6 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160060} /passive /norestart REM JRE Runtime Environment 6.0 Update 5 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160050} /passive /norestart REM JRE Runtime Environment 6.0 Update 4 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160040} /passive /norestart REM JRE Runtime Environment 6.0 Update 3 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160030} /passive /norestart REM JRE Runtime Environment 6.0 Update 2 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160020} /passive /norestart REM JRE Runtime Environment 6.0 Update 1 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160010} /passive /norestart REM JRE Runtime Environment 6.0 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0160000} /passive /norestart REM JRE Runtime Environment 5.0 Update 23 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150230} /passive /norestart REM JRE Runtime Environment 5.0 Update 22 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150220} /passive /norestart REM JRE Runtime Environment 5.0 Update 21 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150210} /passive /norestart REM JRE Runtime Environment 5.0 Update 20 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150200} /passive /norestart REM JRE Runtime Environment 5.0 Update 19 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150190} /passive /norestart REM JRE Runtime Environment 5.0 Update 18 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150180} /passive /norestart REM JRE Runtime Environment 5.0 Update 17 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150170} /passive /norestart REM JRE Runtime Environment 5.0 Update 16 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150160} /passive /norestart REM JRE Runtime Environment 5.0 Update 15 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150150} /passive /norestart REM JRE Runtime Environment 5.0 Update 14 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150140} /passive /norestart REM JRE Runtime Environment 5.0 Update 13 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150130} /passive /norestart REM JRE Runtime Environment 5.0 Update 12 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150120} /passive /norestart REM JRE Runtime Environment 5.0 Update 11 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150110} /passive /norestart REM JRE Runtime Environment 5.0 Update 10 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150100} /passive /norestart REM JRE Runtime Environment 5.0 Update 9 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150090} /passive /norestart REM JRE Runtime Environment 5.0 Update 8 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150080} /passive /norestart REM JRE Runtime Environment 5.0 Update 7 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150070} /passive /norestart REM JRE Runtime Environment 5.0 Update 6 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150060} /passive /norestart REM JRE Runtime Environment 5.0 Update 5 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150050} /passive /norestart REM JRE Runtime Environment 5.0 Update 4 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150040} /passive /norestart REM JRE Runtime Environment 5.0 Update 3 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150030} /passive /norestart REM JRE Runtime Environment 5.0 Update 2 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150020} /passive /norestart REM JRE Runtime Environment 5.0 Update 1 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150010} /passive /norestart REM JRE Runtime Environment 5.0 MsiExec.exe /uninstall {3248F0A8-6813-11D6-A77B-00B0D0150000} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_19 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142190} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_18 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142180} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_17 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142170} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_16 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142160} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_15 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142150} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_14 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142140} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_13 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142130} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_12 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142120} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_11 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142110} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_10 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142100} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_09 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142090} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_08 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142080} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_07 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142070} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_06 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142060} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_05 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142050} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_04 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142040} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_03 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142030} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_02 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142020} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2_01 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142010} /passive /norestart REM Java 2 Runtime Environment, SE v1.4.2 MsiExec.exe /uninstall {7148F0A8-6813-11D6-A77B-00B0D0142000} /passive /norestart REM Java 2 Runtime Environment Standard Edition v1.3.1_25 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_25\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_24br> %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_24\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_23 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_23\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_22 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_22\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_21 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_21\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_20 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_20\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_19 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_19\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_18 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_18\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_17 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_17\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_16 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_16\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_15 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_15\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_14 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_14\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_13 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_13\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_12 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_12\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_11 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_11\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_10 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_10\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_09 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_09\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_08 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_08\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_07 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_07\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_06 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_06\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_05 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_05\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_04 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_04\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_03 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_03\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_02 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_02\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3.1_01 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3.1_01\Uninst.isu" -a REM Java 2 Runtime Environment Standard Edition v1.3 %systemroot%\IsUninst.exe -f"%SystemDrive%\Program Files\JavaSoft\JRE\1.3\Uninst.isu" –a
OMG guys, you use the hardest way with so many strings of code.
I’am used this code when upgrading Java over my 350 workstations, it’s easy to understand, simple and universal for any version of java, you dont need kilometers of uniq install ID’s
it works on computer shutdown or reboot, deletes ony version of java, writedown to log and on computer startup installs a latest version by GPO. and it has a foolproof mechanism, if script find log file it exits prevents deleting new version. script calls deletion of every version twice because some of my users have installed two versions of java( i know it’s sounds crazy 🙂 )
here the script:
if not exist c:\logs mkdir c:\logs
set log=c:\logs\java_uninstall.log
if exist %log% exit
taskkill /F /IM iexplorer.exe >> %log%
taskkill /F /IM iexplore.exe >> %log%
taskkill /F /IM firefox.exe >> %log%
taskkill /F /IM opera.exe >> %log%
taskkill /F /IM chrome.exe >> %log%
taskkill /F /IM jusched.exe >> %log%
taskkill /F /IM jp2launcher.exe >> %log%
taskkill /F /IM java.exe >> %log%
taskkill /F /IM javaw.exe >> %log%
taskkill /F /IM jqs.exe >> %log%
wmic product where “name like ‘Java 6%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java 6%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java 7%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java 7%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java 8%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java 8%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java(TM) 6%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java(TM) 6%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java(TM) 7%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java(TM) 7%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java(TM) 8%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘Java(TM) 8%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘J2SE Runtime Environment%%'” call uninstall /nointeractive >> %log%
wmic product where “name like ‘J2SE Runtime Environment%%'” call uninstall /nointeractive >> %log%
Nice method Vyacheslav!
I know this post is a bit old but I do have an issue. This is great if you are going to restart all of your computers immediately after the install. Problem I see is, if you need to leave this policy intact for any length of time, every time your computers boot up, the installer would run again and again. Am I missing something?
You could handle this a few ways. First, you could modify the script to create a text file in the root of C when it is finished. You could then use an if statement to check for that file.
You could also use Group Policy Preferences to deploy a registry edit. The registry edit would add this script to the run once startup list and would be set to apply once.
Hey Alan, Thanks for sharing this.
Just wanted to say thanks to Kyle Beckman (http://trekker.net) for sending me the Java 6 Update 51 GUIDs. They have been added to the script above.
No problemo!
ftp://ftp.snsconstructions.com/MSIManager.exe dead link
Odd that my link checker didn’t catch that! I replaced the link on the tools page with a link that works. Let me know if you have any other issues.
https://deployhappiness.com/resources/tool-downloads/
You could probably shorten and future-proof the script a bit using something like this
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | findstr 26A24AE4-039D-4CA4-87B4-2F832170 >> “%temp%\dynamic.txt”
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | findstr 26A24AE4-039D-4CA4-87B4-2F864170 >> “%temp%\dynamic.txt”
for /f “delims=” %%a in (“%temp%\dynamic.txt”) do MsiExec.exe /uninstall %%a /passive /norestart
Now I didn’t add all the guids because I’m lazy atm but they seem to follow a set pattern and match up to the last few characters so this should work reliably.
Good idea!!
Hi Joseph, here’s the vbs script that I use to uninstall any JRE 7 version before proceding with the installation part. Hope it helps someone.
x64 installation on 64 bits or x86 installation on a 32 bits system:
On Error Resume Next
Dim strSearchFor
Const HKEY_LOCAL_MACHINE = &H80000002
strSearchFor = “Java 7”
strComputer = “.”
Set WshShell = CreateObject(“wscript.Shell”)
Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” &_
strComputer & “\root\default:StdRegProv”)
strKeyPath = “SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
strDisplayName = WshShell.RegRead (“HKLM\” & strKeyPath & “\” & subkey & “\DisplayName”)
If InStr(1, strDisplayName, strSearchFor) > 0 then
WshShell.Run “msiexec.exe /norestart /X ” & SubKey & ” /qn”, 7, True
Else
End If
Next
x86 installation on a 64 bits system:
On Error Resume Next
Dim strSearchFor
Const HKEY_LOCAL_MACHINE = &H80000002
strSearchFor = “Java 7”
strComputer = “.”
Set WshShell = CreateObject(“wscript.Shell”)
Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” &_
strComputer & “\root\default:StdRegProv”)
strKeyPath = “SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall”
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
strDisplayName = WshShell.RegRead (“HKLM\” & strKeyPath & “\” & subkey & “\DisplayName”)
If InStr(1, strDisplayName, strSearchFor) > 0 then
WshShell.Run “msiexec.exe /norestart /X ” & SubKey & ” /qn”, 7, True
Else
End If
Next
Thank you Guillaume! Very helpful!