VBScript to check existence of regkey then delete key/subkeys
Ok, this script works as long as there are no subkeys. Is there a way to have VBScript delete the key, and all of its values and subkeys in one swoop?
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap"
strKeyName = "Domains"
objRegistry.GetStringValue HKEY_CURRENT_USER,strKeyPath,strKeyName
If IsNull(strKeyName) Then
WScript.Quit
Else
objRegistry.DeleteKey HKEY_CURRENT_USER,strKeyPath,strKeyName
WScript.Quit(1)
End If
0 Comments
[ + ] Show comments
Answers (4)
Please log in to answer
Posted by:
aogilmor
16 years ago
ORIGINAL: bdog
Hey, those sneaky guys added to the article. I only found this http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar05/hey0304.mspx in the archive. Thanks!
You're welcome, bdog. Now where's my ratings points? :-) JKJK
-would be nice though
-O
Posted by:
aogilmor
16 years ago
Take a look at this article. It's also got code to download
http://technet.microsoft.com/en-us/magazine/cc160952.aspx
http://technet.microsoft.com/en-us/magazine/cc160952.aspx
Posted by:
bdog
16 years ago
Hey, those sneaky guys added to the article. I only found this http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar05/hey0304.mspx in the archive. Thanks!
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.