Jump to content
Sign in to follow this  
antmar904

Read Reg

Recommended Posts

antmar904

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
antmar904

Im trying to display all of the sub folders in HKLMSoftwareBeyondTrustSDApplicationsRulesMachine in an array for starters and it is not working.

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

Share this post


Link to post
Share on other sites
JohnOne

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

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
antmar904

i do not get any output.

Share this post


Link to post
Share on other sites
JohnOne

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


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Chimp

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
antmar904

@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
Chimp

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
antmar904

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
antmar904

@JohnOne

I just saw your second code post,

I just tried it and still i get no output.

 

post-75109-0-87847000-1406837683.png

Share this post


Link to post
Share on other sites
Chimp

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
antmar904

@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

you are welcome


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
antmar904

@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
antmar904

@JohnOne,

When i add

RegRead($Key & "\" & $SubKeys[$i][0], "gponame")

it gets rid of the "(Default)" value.

How can i see them both?

Share this post


Link to post
Share on other sites
JohnOne

#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)


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Chimp

@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  

×