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
Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

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.

Answers

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

Please log in to comment
0
Think this post can help
http://itninja.com/question/stopping-a-service09
Answered 03/16/2012 by: henrik80
Second Degree Blue Belt

Please log in to comment
1
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
Answer this question or Comment on this question for clarity