/build/static/layout/Breadcrumb_cap_w.png

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)

Posted by: aogilmor 16 years ago
9th Degree Black Belt
2
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
9th Degree Black Belt
0
Take a look at this article. It's also got code to download
http://technet.microsoft.com/en-us/magazine/cc160952.aspx
Posted by: bdog 16 years ago
Senior Yellow Belt
0
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!
Posted by: bdog 16 years ago
Senior Yellow Belt
0
Thanks for the followup! You've been rated.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ