Sign in to follow this  
Followers 0

Modify registry key

4 posts in this topic

Say that....

HKLMSystemCurrentControlSetControlClassABC contains several different subkeys, such as




Within one of these three subkeys, lies a value name that needs to be changed - we'll call it VALNAME. So it would need to find which one of those three subkeys holds VALNAME - which would be modified.

I am thinking I could just use regread to search for it, but am curious on the best way to parse through them (There are way more than 3 subkeys to search through; this is purely for example)

Share this post

Link to post
Share on other sites

Ok, so using RegEnumKey. 

For example,

For $i = 1 to 20
     Local $var = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\ABC\", $i)


How should you parse through each of those three subkeys above to find "VALNAME"?

Share this post

Link to post
Share on other sites

Taken almost word for word from the example under RegEnumKey...

$path = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\ABC\"
For $i = 1 To 100
    $sSubKey = RegEnumKey($path, $i)
        If @error Then
            $var = RegRead($path & $sSubKey, "VALNAME")
                    If Not @error Then MsgBox(0, $path & $sSubKey, $var)
1 person likes this

When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0