Jump to content
Sign in to follow this  
antmar904

Read Reg

Recommended Posts

Hi All,

I am trying to read the Data for the Name "(Default)" under

HKLMSoftwareBeyondTrustSDApplicationsRulesMachine{ANY NUMBER}

and all sub folders.

I tried using RegRead and RegEnumKey.

 

post-75109-0-07327700-1406753855_thumb.p

Share this post


Link to post
Share on other sites

Not hot on reg off top of head try..

Local $var = ""
For $i = 1 To 100
    $var = RegEnumKey("HKLM\Software\BeyondTrust\SD\Applications\Rules\Machine", $i)
    If @error <> 0 Then ExitLoop
    ConsoleWrite(RegRead($var, "") & @LF)
Next

Share this post


Link to post
Share on other sites

Local $var = ""
For $i = 1 To 100
    $var = RegEnumKey("HKLM\Software\BeyondTrust\SD\Applications\Rules\Machine", $i)
    If @error <> 0 Then ExitLoop
    ConsoleWrite(RegRead("HKLM\Software\BeyondTrust\SD\Applications\Rules\Machine\" & $var, "") & @LF)
Next

Share this post


Link to post
Share on other sites

maybe this?

#include <array.au3>
Local $var = "", $SubKeys[1]
For $i = 1 To 100
    $var = RegEnumKey("HKLM\Software\BeyondTrust\SD\Applications\Rules\Machine", $i)
    If @error <> 0 Then ExitLoop
    _ArrayAdd($SubKeys, $var)
    $SubKeys[0] += 1
Next
_ArrayDisplay($SubKeys)

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

@Chimp 

That worked.  How would i see the value for the key named "(Default)" in each of the sub folders?

Thank you all for your help.

 

post-75109-0-32293400-1406818903_thumb.p

Share this post


Link to post
Share on other sites

if you only need the "(Default)" value then this should do:

#include <array.au3>
Local $var = "", $SubKeys[1][2]
Local $Key = "HKLM\Software\BeyondTrust\SD\Applications\Rules\Machine"
For $i = 1 To 100
    $var = RegEnumKey($Key, $i)
    If @error <> 0 Then ExitLoop
    _ArrayAdd($SubKeys, $var)
    $SubKeys[$i][1] = RegRead($Key & "\" & $SubKeys[$i][0], "")
    $SubKeys[0][0] += 1
Next
_ArrayDisplay($SubKeys)

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Thank you Chimp but the code above gives me no output.

 

Here is a screenshot of what data i would like to get within each sub folder:

 

 

post-75109-0-64435300-1406836109_thumb.p

Share this post


Link to post
Share on other sites

could you try this?

#include <array.au3>
Local $var = "", $SubKeys[1][2]
Local $Key = "HKLM\Software\BeyondTrust\SD\Applications\Rules\Machine"
For $i = 1 To 100
    $var = RegEnumKey($Key, $i)
    If @error <> 0 Then ExitLoop
    ReDim $SubKeys[UBound($SubKeys) + 1][2]
    $SubKeys[$i][0] = $var
    $SubKeys[$i][1] = RegRead($Key & "\" & $SubKeys[$i][0], "")
    $SubKeys[0][0] += 1
Next
_ArrayDisplay($SubKeys)

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

@Chimp

That worked great, I would've never figured that one out.

FYI,

Here is what the output looks like:

Thank you all for your help.

post-75109-0-92619900-1406840180_thumb.p

Edited by antmar904

Share this post


Link to post
Share on other sites

@Chimp

How hard would it be if i wanted to get other data from other keys within the same folder?

Right now i am only gathering the data from the "(Default)" key and would like to also get the data from "gponame".

Ive tried editing your script but failed miserably.

 

 

post-75109-0-08492700-1406899907_thumb.p

Share this post


Link to post
Share on other sites

#include <array.au3>
Local $var = "", $SubKeys[1][3]
Local $Key = "HKLM\Software\BeyondTrust\SD\Applications\Rules\Machine"
For $i = 1 To 100
    $var = RegEnumKey($Key, $i)
    If @error <> 0 Then ExitLoop
    ReDim $SubKeys[UBound($SubKeys) + 1][2]
    $SubKeys[$i][0] = $var
    $SubKeys[$i][1] = RegRead($Key & "\" & $SubKeys[$i][0], "")
    $SubKeys[$i][2] = RegRead($Key & "\" & $SubKeys[$i][0], "gponame")
    $SubKeys[0][0] += 1
Next
_ArrayDisplay($SubKeys)

Share this post


Link to post
Share on other sites

@Chimp

How hard would it be if i wanted to get other data from other keys within the same folder?

Right now i am only gathering the data from the "(Default)" key and would like to also get the data from "gponame".

Ive tried editing your script but failed miserably.

 

to read a single KeyValue use the RegRead passing the Keyname (HKLMSoftwareBeyondTrustSDApplicationsRulesMachine{0019208f-a583-4b8c-bff0-159f22abf6f7})

and the Valuename (gponame in your case)

or you could read all the values of that Keyname in this way for example:

#include <array.au3>
Local $var = "", $i = 0 ,$SubKeys[1][2]
Local $Key = "HKLM\Software\BeyondTrust\SD\Applications\Rules\Machine\{0019208f-a583-4b8c-bff0-159f22abf6f7}"
While True
    $i +=1
    $var = RegEnumVal($Key, $i)
    If @error <> 0 Then ExitLoop
    ReDim $SubKeys[UBound($SubKeys) + 1][2]
    $SubKeys[$i][0] = $var
    $SubKeys[$i][1] = RegRead($Key , $SubKeys[$i][0])
    $SubKeys[0][0] = $i
WEnd
_ArrayDisplay($SubKeys)

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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  

×
×
  • Create New...