Java uninstall of prior versions leaves behind a flag indicatingits still installed
Using SCCM I finaly have something that's working to reboot the pc > uninstall >reboot> install and reboot, all in our nightly maintance window. Save for one issue...whenI go out to www.java.com/verify just as a check to see what Mr Oracle says is there, it says I still have 7u51 installed. I click to uninstall but it can't because its not installed. same with there little log file that says Java 7 Update 51 wasn't uninstalled because of the following error: This action is only valid for products that are currently installed. (error code is 1605).
I think I am missing one little flag or something that is not getting removed. I am not a script guy one of our guys fixed this up for me based on something I found out here. Any ideas? jm
my uninstall script is
'On Error Resume Next Dim WshShell: set WshShell = WScript.CreateObject("WScript.Shell") Dim fso: Set fso = CreateObject ("Scripting.FileSystemObject") Dim stdout: Set stdout = fso.GetStandardStream (1) Dim ThisTimeStamp
Dim Return
Dim objSoftware Const strComputer = "." Dim objWMIService: Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") ThisTimeStamp = year(now()) & "_" & right("0" & month(now()),2) & "_" & right("0" & day(now()),2) & "_" & _
right("0" & hour(TimeValue(Now)), 2) & right("0" & minute(TimeValue(Now)), 2) & right("0" & second(TimeValue(Now)), 2) Return = WshShell.run ("cmd /c ECHO " & "*---START SCRIPT - JAVA UNINSTALL " & Now & " >> " & "C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
Return = WshShell.run ("cmd /c ECHO " & "* >> " & "C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE) '******************************************************************************************************************************
'Uninstall Java 2 Runtime Environment, J2SE Runtime Environment
'******************************************************************************************************************************
Set colJava4dot3 = objWMIService.ExecQuery("Select * from Win32_Product Where Name like 'Java 2 Runtime Environment Standard Edition %'") For Each objSoftware in colJava4dot3
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - START " & Now & " >> " & " C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
objSoftware.Uninstall()
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - END " & Now & " >> " & " C:\JAVA_UNINSTALL_"& ThisTimeStamp & ".LOG", 1, TRUE)
Return = WshShell.run ("cmd /c ECHO " & "* >> " & "C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
Next
'******************************************************************************************************************************
'Uninstall Java 2 Runtime Environment, J2SE Runtime Environment
'******************************************************************************************************************************
Set colJava4dot3 = objWMIService.ExecQuery("Select * from Win32_Product Where Name like 'J2SE Runtime Environment %'") For Each objSoftware in colJava4dot3
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - START " & Now & " >> " & " C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
objSoftware.Uninstall()
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - END " & Now & " >> " & " C:\JAVA_UNINSTALL_"& ThisTimeStamp & ".LOG", 1, TRUE)
Return = WshShell.run ("cmd /c ECHO " & "* >> " & "C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
Next '******************************************************************************************************************************
'Uninstall Java 2 Runtime Environment, SE *
'****************************************************************************************************************************** Set colJava4dot3 = objWMIService.ExecQuery("Select * from Win32_Product Where Name like 'Java 2 Runtime Environment, SE %'") For Each objSoftware in colJava4dot3
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - START " & Now & " >> " & " C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
objSoftware.Uninstall()
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - END " & Now & " >> " & " C:\JAVA_UNINSTALL_"& ThisTimeStamp & ".LOG", 1, TRUE)
Return = WshShell.run ("cmd /c ECHO " & "* >> " & "C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
Next
'******************************************************************************************************************************
'Uninstall Java(TM) 6 Update *
'******************************************************************************************************************************
Set colJava6dot = objWMIService.ExecQuery("Select * from Win32_Product Where Name like 'Java(TM) 6 Update %'") For Each objSoftware in colJava6dot
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - START " & Now & " >> " & " C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
objSoftware.Uninstall()
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - END " & Now & " >> " & " C:\JAVA_UNINSTALL_"& ThisTimeStamp & ".LOG", 1, TRUE)
Return = WshShell.run ("cmd /c ECHO " & "* >> " & "C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
Next
'******************************************************************************************************************************
'Uninstall Java(TM) 7 Update *
'******************************************************************************************************************************
Set colJava7dot = objWMIService.ExecQuery("Select * from Win32_Product Where Name like 'Java 7 Update %'") For Each objSoftware in colJava7dot
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - START " & Now & " >> " & " C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
objSoftware.Uninstall()
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - END " & Now & " >> " & " C:\JAVA_UNINSTALL_"& ThisTimeStamp & ".LOG", 1, TRUE)
Return = WshShell.run ("cmd /c ECHO " & "* >> " & "C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
Next
'******************************************************************************************************************************
'Uninstall Java(TM) 7 *
'******************************************************************************************************************************
Set colJava7 = objWMIService.ExecQuery("Select * from Win32_Product Where Name like 'Java %'") For Each objSoftware in colJava7
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - START " & Now & " >> " & " C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
objSoftware.Uninstall()
Return = WshShell.run ("cmd /c ECHO " & " Uninstall " & objSoftware.Name & " - END " & Now & " >> " & " C:\JAVA_UNINSTALL_"& ThisTimeStamp & ".LOG", 1, TRUE)
Return = WshShell.run ("cmd /c ECHO " & "* >> " & "C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
Next Return = WshShell.run ("cmd /c ECHO " & "*---END SCRIPT - JAVA UNINSTALL " & Now & " >> " & "C:\JAVA_UNINSTALL_" & ThisTimeStamp & ".LOG", 1, TRUE)
Answers (0)
Be the first to answer this question