Re: Delete Parent registry key based on subkey data

Tech-Archive recommends: Fix windows errors by optimizing your registry



I just realised that the logic in this has a flaw. It will only ever delete one key that it finds and I got the impressions from your post that you wanted to delete all instance. Just need to add an extra couple of line in the function which I have edited below.

"Jeremy" <jeremy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:B074C9A5-CD37-47F4-9377-93885979D400@xxxxxxxxxxxxxxxx
I'm not going to write the code for you, but you just need to write a recursive function that calls itself with subkeys of a parent.

Something like this:

--------------------------------------------

Function FindValue(key)
Keytodelete=bogusvalue

For each value in key do
If the value is what I am after then
Keytodelete=key
Exit loop
End if
Next

If Keytodelete=bogusvalue Then
For each subkey in key
Delete Function FindValue(subkey)
Next
End If
FindValue=KeyToDelete
'main program body
RootKey=StartPointofSearch
Delete Function FindValue(RootKey)

--------------------------------------------

Does this make sense to you?
<spatz0r@xxxxxxxxx> wrote in message news:1177507157.684552.273180@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am trying to figure out if it is possible to delete a parent key
based on data in the subkey. For example, the following registry key
automatically generates a random number behind the key
(network#FD3D2E5EDBD3FED8A925FE1A99DC616942D6DAFF), but the ID subkey
will always be the same on all PC's.

Is there a way to parse the registry for that ID and then delete the
parent key through a VBS or some other script.

[HKEY_CURRENT_USER\Software\GINA\client\networks
\network#FD3D2E5EDBD3FED8A925FE1A99DC616942D6DAFF]
"associationMode"="open"
"ccxNetworkEap"="0"
"channel"="0"
"description"=""
"encryption"="802.1x"
"encryptionType"="WEP"
"id"="e8jne9ds9739a9b97872d4d689102"

Thanks
John Anderson



.



Relevant Pages

  • Re: SfcIsKeyProtected (Windows Resource Protection)
    ... thank you very much for responding again. ... HKEY - a handle to a registry key. ... anything for the SubKey. ... to check the root key and it returned the same codes. ...
    (microsoft.public.platformsdk.security)
  • Re: SfcIsKeyProtected (Windows Resource Protection)
    ... "Idan " wrote: ... HKEY - a handle to a registry key. ... I tried passing NULL for the subkey ... to check the root key and it returned the same codes. ...
    (microsoft.public.platformsdk.security)
  • Unable to delete registry key
    ... I have the following registry key: ... permissions on that subkey and so I'm not able to delete the parent key ... somehow engineered by they "nice" people over at SecuRom in some. ... (Exporing just that key only exports the parent key, without any subkeys, by ...
    (microsoft.public.windowsxp.general)
  • Re: Unable to delete registry key
    ... CTR+ALT+DELETE twice, log in as Admin, go to REGEDIT and try again ... > I have the following registry key: ... > permissions on that subkey and so I'm not able to delete the parent key ... > (Exporing just that key only exports the parent key, without any subkeys, ...
    (microsoft.public.windowsxp.general)
  • DCOM Error 10010
    ... I would like to use this as a possible fix but I am not sure where to ... create the following registry key: ... Create a subkey with {CLSID} as its name, where the CLSID is the class ...
    (microsoft.public.windows.server.sbs)