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.


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)%'"

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
LogIt Now() & ": " &replace(strComputer,".","localhost") & ": Uninstalling: " & objVersion.Name & ":" & objVersion.IdentifyingNumber
end if
Answer Summary:
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


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.
Answered 03/15/2012 by: VBScab
Red Belt

Please log in to comment
Think this post can help
Answered 03/16/2012 by: henrik80
Second Degree Blue Belt

Please log in to comment
I think this is the page VBScab is referring to: http://www.itninja.com/question/silent-uninstall-java-all-versions
Answered 03/19/2012 by: RonW
Green Belt

Please log in to comment