/build/static/layout/Breadcrumb_cap_w.png

Uninstall old Java Version with VBScript CA

Hi,
I'm trying to uninstall all previous versions of Java before installing the latest 31. I use a VB script custom action to do the same.
The VB Script works fine when I run it outside package. But when I use it as a custom action, the previous versions are not uninstalling.
I verified that custom action runs by inserting message box within VB script. The following code in VB Script has no effect within CA.

objVersion.Uninstall()

Please help!

Part of VB Script
------------------
strCurrentVersion = "Java(TM) 6 Update 31"
strExecQuery = "Select * from Win32_Product Where Name LIKE '%Java 2 Runtime Environment%' OR Name LIKE '%J2SE Runtime Environment%' OR Name LIKE '%Java(TM)%'"
KillProc

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledVersions = objWMIService.ExecQuery (strExecQuery)

LogIt String(120, "_")
LogIt String(120, "¯")
For Each objVersion in colInstalledVersions
If objVersion.Name = strCurrentVersion then
LogIt Now() & ": " &replace(strComputer,".","localhost") & ": Current version is installed: " & objVersion.Name & ":" & objVersion.IdentifyingNumber
else
LogIt Now() & ": " &replace(strComputer,".","localhost") & ": Uninstalling: " & objVersion.Name & ":" & objVersion.IdentifyingNumber
objVersion.Uninstall()
end if
Next

0 Comments   [ + ] Show comments

Answers (3)

Answer Summary:
Posted by: RonW 12 years ago
Green Belt
1
I think this is the page VBScab is referring to: http://www.itninja.com/question/silent-uninstall-java-all-versions
Posted by: anonymous_9363 12 years ago
Red Belt
0
You don't say whether the script is being run as an embedded VBScript, extracted from the Binary table and executed or run as a file installed as part of the upgrade package. You also fail to tell us what error is logged (I notice the total absence of error-checking in the code...)

Having said that, there is a proven script posted here on AppDeploy. I can't recall if it's in this forum or the 'Scripting' forum.
Posted by: henrik80 12 years ago
Second Degree Blue Belt
0
Think this post can help
http://itninja.com/question/stopping-a-service09
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ