cookie_monster Posted November 6, 2009 Posted November 6, 2009 (edited) I've been using a kix script to do this for ages (Delete registry keys with sub keys) that I couldn't do with a VB script then today I came accross a technet tutorial and I think I'm there. This might of already been posted but it didn't come up in a search. Hey, Scripting Guy!: How Can I Delete a Key and its Subkeys from the Registry? EDIT I just need to work out how to point it to this key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder" then I'm there. (Scratches head) Edited November 6, 2009 by cookie_monster 1
cookie_monster Posted November 6, 2009 Author Posted November 6, 2009 Right it's sorted now to put it into my real script On Error Resume Next Const HKEY_CURRENT_USER = &H80000001 strComputer = "." strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder" Set objRegistry = GetObject("winmgmts:\\" & _ strComputer & "\root\default:StdRegProv") DeleteSubkeys HKEY_CURRENT_USER, strKeypath Sub DeleteSubkeys(HKEY_CURRENT_USER, strKeyPath) objRegistry.EnumKey HKEY_CURRENT_USER, strKeyPath, arrSubkeys If IsArray(arrSubkeys) Then For Each strSubkey In arrSubkeys DeleteSubkeys HKEY_CURRENT_USER, strKeyPath & "\" & strSubkey Next End If objRegistry.DeleteKey HKEY_CURRENT_USER, strKeyPath End Sub Some excellent extra info here on using WMI and VB to modify the registry. http://blogs.technet.com/heyscriptingguy/archive/2004/10/27/how-can-i-change-the-screensaver-timeout-value.aspx
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now