Stephon98caffe
Programmer
The registry is not delete once I go into regedit. Does the code I have looking right
On Error Resume Next
Const HKU = &H80000003
strComputer = "."
Set StdOut = CreateObject("WScript.StdOut")
sMethod = "DeleteKey"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
Set oReg2=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_
strComputer & "/root/default:StdRegProv")
Set oReg3=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_
strComputer & "/root/default:StdRegProv")
Set oReg4=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_
strComputer & "/root/default:StdRegProv")
Set oReg5=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_
strComputer & "/root/default:StdRegProv")
strKeyPath = ""
oReg.EnumKey HKU, strKeyPath, arrSubKeys
set oMethod = oReg.Methods_(sMethod)
set oInParam = oMethod.inParameters.SpawnInstance_()
strdeleteKeyPath = ""
For Each subkey In arrSubKeys
' .DEFAULT, etc.
' Check for the contents of HKEY_USERS->Software
strKeyPath2 = subkey & "\Software"
oReg2.EnumKey HKU, strKeyPath2, arrSubKeys2
For Each subkey2 In arrSubKeys2
If subkey2 = "CENS Client" Then
' Nelda said that if the "CENS Client" hive exists, then assume the Settings sub-hive exists
strKeyPath3 = strKeyPath2 & "\CENS Client\Settings"
strdeleteKeyPath = "\CENS Client\Settings"
Wscript.Echo strKeyPath3
' 'Delete the ...\CENS Client\Settings hive
Return = objReg.DeleteKey(HKU,strKeyPath3)
Wscript.Echo Return
Else
End If
Next
Next
On Error Resume Next
Const HKU = &H80000003
strComputer = "."
Set StdOut = CreateObject("WScript.StdOut")
sMethod = "DeleteKey"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
Set oReg2=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_
strComputer & "/root/default:StdRegProv")
Set oReg3=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_
strComputer & "/root/default:StdRegProv")
Set oReg4=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_
strComputer & "/root/default:StdRegProv")
Set oReg5=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_
strComputer & "/root/default:StdRegProv")
strKeyPath = ""
oReg.EnumKey HKU, strKeyPath, arrSubKeys
set oMethod = oReg.Methods_(sMethod)
set oInParam = oMethod.inParameters.SpawnInstance_()
strdeleteKeyPath = ""
For Each subkey In arrSubKeys
' .DEFAULT, etc.
' Check for the contents of HKEY_USERS->Software
strKeyPath2 = subkey & "\Software"
oReg2.EnumKey HKU, strKeyPath2, arrSubKeys2
For Each subkey2 In arrSubKeys2
If subkey2 = "CENS Client" Then
' Nelda said that if the "CENS Client" hive exists, then assume the Settings sub-hive exists
strKeyPath3 = strKeyPath2 & "\CENS Client\Settings"
strdeleteKeyPath = "\CENS Client\Settings"
Wscript.Echo strKeyPath3
' 'Delete the ...\CENS Client\Settings hive
Return = objReg.DeleteKey(HKU,strKeyPath3)
Wscript.Echo Return
Else
End If
Next
Next