Jump to content

Searching the registry


Allegro
 Share

Recommended Posts

I have looked high and low for a solution to searching the registry and report back the info I need. I know where to look for the key directly, but it can vary from system to system. For example one of the keys is located under HKEY_LOCAL_MACHINE\SYSTEM\CONTROLSET001 on one system and under CONTROLSET002 on another.

For example, I need to look for CDS_LIC_FILE and tell me the exact location.

I need to read and modify this registry entry, which I know how, But I just need to find it first.

Looked at RegEnumVal and RegEnumKey, but no luck.

Can anyone help? Much appreciated.

Link to comment
Share on other sites

I have looked high and low for a solution to searching the registry and report back the info I need. I know where to look for the key directly, but it can vary from system to system. For example one of the keys is located under HKEY_LOCAL_MACHINE\SYSTEM\CONTROLSET001 on one system and under CONTROLSET002 on another.

For example, I need to look for CDS_LIC_FILE and tell me the exact location.

I need to read and modify this registry entry, which I know how, But I just need to find it first.

Looked at RegEnumVal and RegEnumKey, but no luck.

Can anyone help? Much appreciated.

Underneath each profile, is the path the same, meaning the only variable is ControlSetXXX?

If not, you'll need a more elaborate routine.

$PathToValue = "\You\Know\Where"
For $i= 1 to   100
    $var = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM", $i)
    If @error <> 0 then ExitLoop
    If StringInStr($var, "ControlSet") Then
        $value = RegRead("HKLM\SYSTEM\" &  $var & $PathToValue, "CDS_LIC_FILE")
        If $value <> "" Then
            ExitLoop
        EndIf
    EndIf
Next

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Hey, thanks. But the path is deeper than just the CONTROLSET. It is located in HKEY_LOCAL_MACHINE\SYSTEM\CONTROLSET002\CONTROL\SESSION MANAGER\ENVIRONMENT. I suppose that I could test each CONTROLSET to see if it is in there, but I was hoping for just a straight search..

Any ideas?

thanks

Link to comment
Share on other sites

Hey, thanks. But the path is deeper than just the CONTROLSET. It is located in HKEY_LOCAL_MACHINE\SYSTEM\CONTROLSET002\CONTROL\SESSION MANAGER\ENVIRONMENT. I suppose that I could test each CONTROLSET to see if it is in there, but I was hoping for just a straight search..

Any ideas?

thanks

Yeah, you answered my question... I didn't know the value you were looking for was an environment variable.

Just change the first line:

$PathToValue = "[b]\CONTROL\SESSION MANAGER\ENVIRONMENT[/b]"

If the path after ControlSetXXX was different then you'd need a more robust search process.

Alex Peters posted a Registry Clone UDF long ago that is the closest thing that comes to mind. (Other than reading the output of regfind.exe)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Just tried it, searching for CDS_LIC_FILE. Found it alright. But there are 4 instances of them, in different CONTROLSETs . I have other problems to solve now.. :)

Thanks for the link to the search utility. Much appreciated.

Does it appear under CurrentControlSet?

CurrentControlset is an alias to another profile.

Read the value of HKLM\System\Select\Current to see which it is.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...