OK - I've done a bit of research and it seems that by using the regdelete
method you need to replace "\" with "\\" if the valuename has any
backslashes in it. However, for some odd reason, I can't seem to get it to
delete the following:
Key: HKLM\SOFTWARE\Microsoft\NAL\CLIENT\Preferred AbExprtDB\CAP List for
site KNA\
Value Name: MSWNET:["SMS_SITE=SITENAME"]\\\CAP_SITESERVER\
No Value Data
The error generated states invalid root - which tells me that it is hanging
up on the backslashes in the value name. Ok, that's fine, I figured if I
replaced the "\" with "\\", then it would solve my problem, but it still
didn't work after that, resulting in the same error.
Is there something I'm missing here?
Thanks all...!
Rob
-------------------------------------------------
strSMSSiteName = "SITENAME"
strCAPServer = "SITESERVER"
strComputer = "."
const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\NAL\CLIENT\Preferred " _
& AbExprtDB\CAP List for site SITENAME"
oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath,_
arrValueNames, arrValueTypes
For i=0 To UBound(arrValueNames)
If UCase(arrValueNames(i)) <> UCase("MSWNET:[" & Chr(34) _
& "SMS_SITE=strSMSSiteName" & Chr(34) & "]\\" & strCAPServer _
& "\cap_" & strSMSSiteName & "\") Then
strDeleteKey = arrValuenames(i)
'Here's where I tried strDeleteKey =
replace(arrValuenames(i),"\","\\") to no avail.
strDelete = "HKLM\" & strKeyPath & "\" & strDeleteKey
WshShell.RegDelete strDelete
End If
Next