Windows Vista Forums

searching registry: know the value, don't know the key

  1. #1


    Tony Logan Guest

    searching registry: know the value, don't know the key

    I'm stumped. I'm trying to figure out how to edit the date for a registry
    value when I don't know the exact key location that value appears under.

    I know the value I'm interested in will appear somewhere beneath this key
    (or one of this keys sub-keys):
    SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}

    I know the name of the value is "WakeUpModeCap".

    I also know the data for this value should be "3", but could also be other
    numeric values.

    Can anyone help get me started? Thanks.


      My System SpecsSystem Spec

  2. #2


    Tony Logan Guest

    RE: searching registry: know the value, don't know the key

    Got part of the way to an answer, but I'm going to repost, since my issue is
    now in a different topic. My partial solution is that since I know the
    approximate place in the registry where I need to make a possible change, I'm
    exporting that key and all its contents, then editing the .reg file (since
    it's a text file and since I know how to edit a text file), then importing
    that key. Will post a separate entry about a better wat to edit the .reg file
    than how I'm doing it now.

    "Tony Logan" wrote:

    > I'm stumped. I'm trying to figure out how to edit the date for a registry
    > value when I don't know the exact key location that value appears under.
    >
    > I know the value I'm interested in will appear somewhere beneath this key
    > (or one of this keys sub-keys):
    > SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}
    >
    > I know the name of the value is "WakeUpModeCap".
    >
    > I also know the data for this value should be "3", but could also be other
    > numeric values.
    >
    > Can anyone help get me started? Thanks.
    >

      My System SpecsSystem Spec

  3. #3


    \RemS Guest

    RE: searching registry: know the value, don't know the key

    "Tony Logan" wrote:

    > I'm stumped. I'm trying to figure out how to edit the date for a registry
    > value when I don't know the exact key location that value appears under.
    >
    > I know the value I'm interested in will appear somewhere beneath this key
    > (or one of this keys sub-keys):
    > SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}
    >
    > I know the name of the value is "WakeUpModeCap".
    >
    > I also know the data for this value should be "3", but could also be other
    > numeric values.
    >
    > Can anyone help get me started? Thanks.
    Here is a start:
    http://www.microsoft.com/technet/scr....mspx?mfr=true


    Sample:
    '----------------------------------------------------------------------------

    Const HKEY_LOCAL_MACHINE = &H80000002
    Const HKEY_USERS = &H80000003
    Const REG_SZ = 1
    Const REG_EXPAND_SZ = 2
    Const REG_BINARY = 3
    Const REG_DWORD = 4
    Const REG_MULTI_SZ = 7

    Dim objReg, strRootPath, RegKey, ValueName, DataType

    RegEntryName = "WakeUpModeCap"
    strKeyPath = "SYSTEM\CurrentControlSet\Control\" _
    & "Class\{4D36E972-E325-11CE-BFC1-08002bE10318}"

    strComputer = "."
    Set objReg = GetObject( _
    "winmgmts:{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\default:StdRegProv")

    SearchInKey HKEY_LOCAL_MACHINE, strKeyPath 'recursively subkeys too

    Wscript.echo "Done" : Wscript.quit

    Sub SearchInKey(ByVal Hive, ByVal strKeyPath)
    ItemsInKey Hive, strKeyPath

    objReg.EnumKey Hive, strKeyPath, arrSubKeys
    If TypeName(arrSubKeys) <> "Null" Then
    For Each subkey In arrSubKeys
    SearchInKey Hive, strKeyPath & "\" & subkey
    Next
    End If
    End Sub

    Function ItemsInKey(ByVal Hive, ByVal strKeyPath)
    Dim strOUT, DataType
    Select Case Hive
    Case -2147483646 strRootPath = "HKLM\"
    Case -2147483645 strRootPath = "HKCU\"
    Case Else strRootPath = "<...>\"
    End Select

    objReg.EnumValues Hive, strKeyPath, arrValueNames, arrValueTypes
    If TypeName(arrValueNames) <> "Null" Then
    For i = 0 To UBound(arrValueNames)
    ValueName = arrValueNames(i)
    RegKey = strKeyPath
    strOUT = SearchForItem(RegEntryName)
    If Len(strOUT) >1 Then

    Select Case arrValueTypes(i)

    Case REG_SZ
    DataType = "REG_SZ: " ' (String)
    objReg.GetStringValue Hive, _
    strKeyPath, ValueName, strValue
    wscript.echo strOUT & DataType, strValue

    Case REG_EXPAND_SZ
    DataType = "REG_EXPAND_SZ: " ' (Expanded String)
    objReg.GetExpandedStringValue Hive, _
    strKeyPath, ValueName, estrValue
    wscript.echo strOUT & DataType, estrValue

    Case REG_BINARY
    DataType = "REG_BINARY" ' (Binary)
    objReg.GetBinaryValue Hive, _
    strKeyPath, ValueName,arrValue
    If TypeName(arrValue) <> "Null" Then
    For k = 0 to UBound(arrValue) -1 step 2
    strChar = chr(arrValue(k))
    sValue = sValue & strChar
    Next
    End If
    wscript.echo strOUT & DataType, sValue

    Case REG_DWORD
    DataType = "REG_DWORD: " ' (DWORD)
    objReg.GetDWORDValue Hive, _
    strKeyPath, ValueName,dwValue
    wscript.echo strOUT & DataType, dwValue

    Case REG_MULTI_SZ
    DataType = "REG_MULTI_SZ: " ' (Multi String)
    objReg.GetMultiStringValue Hive, _
    strKeyPath, ValueName,arrValues
    If TypeName(arrValues) <> "Null" Then
    For Each strValue in arrValues
    sValue = sValue & strValue & vbNewLine
    Next
    End If
    wscript.echo strOUT & DataType, sValue

    End Select
    End If
    Next
    End If
    End Function

    Function SearchForItem(RegEntryName)
    If lCase(ValueName) = lCase(RegEntryName) Then
    SearchForItem = strRootPath & RegKey & "\" _
    & vbNewLine & vbNewLine & ValueName & vbNewLine
    Else
    SearchForItem = Empty
    End If
    End Function

    '----------------------------------------------------------------------------

    \Rems

      My System SpecsSystem Spec

searching registry: know the value, don't know the key

Similar Threads
Thread Forum
Re: Uniblue Registry Booster and registry scans.
Thanks for all the info and advice. I will be a lot more careful with the use of these programs in the future. qq "rq" <qurandc@newsgroup>...
Vista General
Help and feedback with script searching the registry with regular expression
Hi Hope someone might help me out, since I'm stuck. I have to search the registry of several computers to find if there is a...
VB Script
Registry Search Tool... Cleaning Up Vista Registry...
All for Vista 64-bit Ultimate: 1.) I've had a third falling out over 25 or so years with Symantec/Norton and am looking for a Registry search...
Vista General
Wise Registry Cleaner vs AusLogics Registry Defrag vs CCLeaner?
Hello there, I've been looking around for a registry defragment tool/cleaner tool for windows vista to keep my laptop and desktop in top shape. ...
Vista performance & maintenance
Registry Export Not Inserting Into Registry
My exported registry entries, when double clicked simply open in a text editor window instead of trying to insert into the registry. I have other...
Vista General
Registry Semi-Disaster: I am an idiot - used 2 registry 'cleaners'
take your Vista dvd, insert and run setup.exe, re-install the OS to the same partition where windows is now, without formatting the HD. That will...
Vista General
Still searching for way to get Vista search to work: Why doesn't FilterFilesWithUnknownExtensions registry key work in Vista?
From Comment #2 from this posting http://www.pcmagvote.com/story.php?title=File_Search_in_Vista_Worse_than_Windows_95_98_2000_and_XP-1 2) I...
Vista General