Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Delete Parent registry key based on subkey data

HTVi
TV Discussion Newsgroups

Delete Parent registry key based on subkey data
spatz0r[ at ]gmail.com 4/25/2007 1:19:17 PM
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

Re: Delete Parent registry key based on subkey data
"Jeremy" <jeremy[ at ]discussions.microsoft.com> 4/26/2007 10:02:18 AM
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
Call Function FindValue(subkey)
Next
End If

'main program body
RootKey=StartPointofSearch
FindValue(RootKey)
Delete KeytoDelete

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

Does this make sense to you?
<spatz0r[ at ]gmail.com> wrote in message
news:1177507157.684552.273180[ at ]r30g2000prh.googlegroups.com...
[Quoted Text]
>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
>

Re: Delete Parent registry key based on subkey data
"Jeremy" <jeremy[ at ]discussions.microsoft.com> 4/26/2007 9:19:38 PM
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[ at ]discussions.microsoft.com> wrote in message
news:B074C9A5-CD37-47F4-9377-93885979D400[ at ]microsoft.com...
[Quoted Text]
> 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[ at ]gmail.com> wrote in message
> news:1177507157.684552.273180[ at ]r30g2000prh.googlegroups.com...
>>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
>>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen