Java 8 Remove Prior Versions
I am responsible for the Java upgrade deployment in my organization and we used to remove prior versions until Oracle decided not to in Java 8 update 20.
Using AdminStudio, I added a custom action VBScript to run and remove all prior versions which by itself works fine.
strComputer="."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product Where Name LIKE 'Java 8%%' AND NOT name like '%%(64-bit)'")
For Each objSoftware in colSoftware
objSoftware.Uninstall()
Next
However, if I use any other switches to call the MSI such as /qb the script doesn't run.
Is there a way to force the custom action to run no matter how the MSI is "called?"
Thanks!
Answers (10)
Top Answer
I had to recently remove all versions of Java prior to 8u51 and install it.
I found that if you use WMIC it seems to work perfectly fine with Java products for uninstalling.
This may work for you, it did for me.Here's what I did with mine, this is a copy of the job items (you might want to copy all of this into notepad and then replace the single and double quotes before pasting some of the commands into KACE):
- Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java 2 Runtime%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'J2SE Runtime%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'J2SE Develop%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Log “Java 2 Uninstall completed” to “status”.
- Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java SE Development%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java(TM) SE Runtime%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Log “Java SE Development Uninstall completed” to “status”.
- Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java Web Start%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Log “Java Web Start Uninstall completed” to “status”.
- Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java Auto Updater%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Log “Java Auto Updater Uninstall completed” to “status”.
- Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java 6 Update%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java(TM) 6 Update%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Log “Java 6 Uninstall completed” to “status”.
- Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java 7 Update%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java(TM) 7 Update%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Log “Java 7 Uninstall Completed” to “status”.
- Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java 8 Update%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Launch “c:\
Windows\ ” with params “/c WMIC product where ”Name LIKE 'Java(TM) 8 Update%%'“ call uninstall /System32\ cmd.exe nointeractive ”. - Log “Java 8 Uninstall Completed” to “status”.
- Launch “c:\
windows\ ” with params “/i $(KACE_DEPENDENCY_DIR)\system32\ msiexec.exe jre1.8.0_51.msi / ”.qn / NORESTART JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 RebootYesNo=No - Log “Java 8 Update MSI Install completed” to “status”.
- Run the batch file “JavaSettings.cmd” with params “”.
- Log “Java Settings Import completed” to “status”.