Hi,
I am using below script to uninstall all previous version of java 6 (64 bit) in a windows 7 64 bit system using sccm 2007. It is not uninstalling via sccm but same script is uninstalling when i tried to run it manually as a administrator. Could you please suggest whether ths issue in the script or in Sccm?
FYI- the system has the 32 bit sccm client installed
const HKEY_CLASSES_ROOT = &H80000000
const HKEY_CURRENT_USER = &H80000001
const HKEY_LOCAL_MACHINE = &H80000002
const HKEY_USERS = &H80000003
const HKEY_CURRENT_CONFIG = &H80000004
const HKEY_DYN_DATA = &H80000005
strComputer = "."
set oWsh = createobject("wscript.shell")
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
strKeyPath1 = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"
strValueName1 = "Identifier"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath1,strValueName1,strValue1
if (instr(strValue1,"64")) then
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ' Root level
End If
if (instr(strValue1,"x86")) then
strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" ' Root level
End If
'-------------------------------------------------------------------------------------------------------
Dim cmd_a, cmd_b
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
sMatch = "C:\Program Files\Java\jre6\"
For Each subkey In arrSubKeys
on error resume next
sDisplayName = oWsh.Regread("HKLM\" & strKeyPath & "\" & subkey & "\InstallLocation")
'msgbox sDisplayName
'msgbox sDisplayName
if err.number = 0 then
on error goto 0
if instr(sDisplayName, sMatch) > 0 then
On Error Resume Next
sUninstall = oWsh.Regread("HKLM\" & strKeyPath & "\" & subkey & "\UnInstallString")
If Err.Number = 0 Then
cmd_a = sUninstall & " /qn"
cmd_b = "exit"
owsh.RUN "cmd /k" & cmd_a & "&" & cmd_b, 0, True
'msgbox sUninstall
Else
End If
On Error GoTo 0
end if
end if
Next
on error goto 0