Login | |
|
 |
RE: Function to Delete a Registry Key - 6/1/2007 6:04:43 AM
|
|
 |
|
| |
DiGiTAL.SkReAM
Posts: 1157
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
|
Apparently, Microsoft has released an update that breaks this functionality when used in this way. I am not sure which update it was, but I am seeing this work on some computers that have not updated in a few months, but it doesn't delete keys with subkeys on computers that HAVE updated recently. So. The only reliable way I have found as of yet to delete a key and any/all of its subkeys and values, is you have to write a reg file that will delete the key you select. For example: Windows Registry Editor Version 5.00 [-HKEY_LOCAL_MACHINE\SYSTEM\Mykey] and then run it with a regedit /s file.reg I will post a complete function to do this when time allows, but I wanted to get this up here so that maybe someone else can address this before I have to. heheheh
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers) "It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
|
|
| |
|
|
|
 |
RE: Function to Delete a Registry Key - 6/3/2007 2:13:24 PM
|
|
 |
|
| |
DiGiTAL.SkReAM
Posts: 1157
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
|
Yes, I did have that typo in there. However, I have noticed, that like so many things with WMI, that this function is not reliable. It works most of the time, but occasionally fails to delete the key if subkeys exist. Not all the time, but just enough to drive me stark raving mad. Thanks for the code. I have my own, but I have "optimized" it to work with my includes file, so it references a few of my own functions that I have just been too lazy to recode here. Note: On Windows NT, etc. the first line needs to be REGEDIT4 and there should be no space between this line and the keyname: REGEDIT4 [-keyname]
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers) "It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
|
|
| |
|
|
|
|
|