This project has moved and is read-only. For the latest updates, please go here.

Uninstall Java 7 via WPP

Topics: Configuration Issue, Feature Request, Publishing Issue
Nov 28, 2014 at 9:18 AM
Is there any way to uninstall all versions of java 7 via wpp?

Like you do with a startup script " wmic product where "name like 'Java(TM) 7%%'" call uninstall /nointeractive "? Is there any way to get this wmic request working using wpp?

Is there another best way to uninstall old java versions using wpp?
How do I get wmi querys to work for detection (already installed) / (update is installable).?


//Matheus
Nov 28, 2014 at 2:11 PM
You can try msiexec /uninstall in a startupscript.
http://www.adminarsenal.com/admin-arsenal-blog/silently-uninstall-java

You can create a Batch like this: https://docs.oracle.com/cd/E19528-01/819-5699/afcil/index.html

And you can publish your Java Package for deinstallation.
Nov 28, 2014 at 5:39 PM
If you want to do this with WPP, create a script that runs the uninstaller for all versions of java 7 installed on the computer and have customupdateengine.exe run the script.

Example script (NOTE: this script does not check for running IE or java or javaw first.):
dim objWMIService

'stop the Java Quick Start service if it's running
set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
set colServices = objWMIService.ExecQuery("Select * from win32_Service where Name='JavaQuickStarterService'")
for each objService in colServices
    objService.StopService()
next

'wait for the Java Quick Start service to stop
dim bJQSRunning
bJQSRunning = true
while bJQSRunning
    WScript.Sleep 1000
    set colServices = objWMIService.ExecQuery("Select * from win32_Service where Name='JavaQuickStarterService'")
    for each objService in colServices
        bJQSRunning = (StrComp(objService.State, "Stopped") = 0) 'alternately 
    next
wend

' Product/GUID pairs
dim dProducts
set dProducts = CreateObject("Scripting.Dictionary")
dProducts.add "Java Updater", "{4a03706f-666a-4037-7777-5f2748764d10}"
dProducts.add "Java 7 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217000ff}"
dProducts.add "Java 7 Update 1 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217001ff}"
dProducts.add "Java 7 Update 2 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217002ff}"
dProducts.add "Java 7 Update 3 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217003ff}"
dProducts.add "Java 7 Update 4 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217004ff}"
dProducts.add "Java 7 Update 5 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217005ff}"
dProducts.add "Java 7 Update 6 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217006ff}"
dProducts.add "Java 7 Update 7 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217007ff}"
dProducts.add "Java 7 Update 9 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217009ff}"
dProducts.add "Java 7 Update 10 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217010ff}"
dProducts.add "Java 7 Update 11 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217011ff}"
dProducts.add "Java 7 Update 13 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217013ff}"
dProducts.add "Java 7 Update 15 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217015ff}"
dProducts.add "Java 7 Update 17 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217017ff}"
dProducts.add "Java 7 Update 21 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217021ff}"
dProducts.add "Java 7 Update 25 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217025ff}"
dProducts.add "Java 7 Update 40 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217040ff}"
dProducts.add "Java 7 Update 45 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217045ff}"
dProducts.add "Java 7 Update 51 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217051ff}"
dProducts.add "Java 7 Update 55 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217055ff}"
dProducts.add "Java 7 Update 60 32-bit", "{26a24ae4-039d-4ca4-87b4-2f83217060ff}"
dProducts.add "Java 7 Update 65 32-bit", "{26a24ae4-039d-4ca4-87b4-2f03217065ff}"
dProducts.add "Java 7 Update 67 32-bit", "{26a24ae4-039d-4ca4-87b4-2f03217067ff}"
dProducts.add "Java 7 Update 71 32-bit", "{26a24ae4-039d-4ca4-87b4-2f03217071ff}"
dProducts.add "Java 7 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417000ff}"
dProducts.add "Java 7 Update 1 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417001ff}"
dProducts.add "Java 7 Update 2 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417002ff}"
dProducts.add "Java 7 Update 3 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417003ff}"
dProducts.add "Java 7 Update 4 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417004ff}"
dProducts.add "Java 7 Update 5 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417005ff}"
dProducts.add "Java 7 Update 6 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417006ff}"
dProducts.add "Java 7 Update 7 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417007ff}"
dProducts.add "Java 7 Update 9 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417009ff}"
dProducts.add "Java 7 Update 10 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417010ff}"
dProducts.add "Java 7 Update 11 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417011ff}"
dProducts.add "Java 7 Update 13 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417013ff}"
dProducts.add "Java 7 Update 15 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417015ff}"
dProducts.add "Java 7 Update 17 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417017ff}"
dProducts.add "Java 7 Update 21 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417021ff}"
dProducts.add "Java 7 Update 25 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417025ff}"
dProducts.add "Java 7 Update 40 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417040ff}"
dProducts.add "Java 7 Update 45 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417045ff}"
dProducts.add "Java 7 Update 51 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417051ff}"
dProducts.add "Java 7 Update 55 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417055ff}"
dProducts.add "Java 7 Update 60 64-bit", "{26a24ae4-039d-4ca4-87b4-2f86417060ff}"
dProducts.add "Java 7 Update 65 64-bit", "{26a24ae4-039d-4ca4-87b4-2f06417065ff}"
dProducts.add "Java 7 Update 67 64-bit", "{26a24ae4-039d-4ca4-87b4-2f06417067ff}"
dProducts.add "Java 7 Update 71 64-bit", "{26a24ae4-039d-4ca4-87b4-2f06417071ff}"

' run uninstallers
Dim sProduct
for each sProduct in dProducts
    uninstallProduct sProduct, dProducts
next

Function uninstallProduct(sProductName, dProductCodes)
    ' Uninstall product using msiexec /qn /norestart /x {PRODUCT CODE}
    oShell.Run "msiexec.exe /qn /norestart /x " + dProductCodes.Item(sProductName), 10, true
End Function
Nov 29, 2014 at 11:24 AM
austinian wrote:
Example script (NOTE: this script does not check for running IE or java or javaw first.):
Wow, thank you very much for the Script! :)
Dec 1, 2014 at 8:32 PM
It's pretty flexible, you can modify it to use a file for the products input instead of having them listed in the script, if you want to use it to uninstall a bunch of stuff at once, so long as the stuff supports msi uninstallation.
Jan 7, 2015 at 4:30 PM
Hi austinian and thanks for the script, but i'm to stupid to use this as a base for an own script :( is it possible that you give me your full vbs?

thanks in advanced
Jan 12, 2015 at 5:47 PM
How is it not working for you? The script will work as long as neither Java nor any web browsers are running. I'm not sure what you're asking for. I make this run when users aren't logged in, and JQS is disabled on all the computers on my network, so I don't have to worry about killing things to get it to run. If you look through this list, you'll see that this only uninstalls old versions of Java 7, not Java 6 or Java 8.
Jan 13, 2015 at 12:12 PM
Edited Jan 13, 2015 at 12:13 PM
Maybe i'm too stupid, but i copied your complete code and save this as uninstalljre.vbs and then execute this vbs with cscript .vbs or wscript .vbs in a commandline for testing. but nothing happens :(

Update --> Or does it only work if i use it with customupdateengine?

Am 12.01.2015 um 18:48 schrieb austinian: From: austinian How is it not working for you? The script will work as long as neither Java nor any web browsers are running. I'm not sure what you're asking for. I make this run when users aren't logged in, and JQS is disabled on all the computers on my network, so I don't have to worry about killing things to get it to run. If you look through this list, you'll see that this only uninstalls old versions of Java 7, not Java 6 or Java 8.