Jump to content

How to save Registry keys


Go to solution Solved by Docfxit,

Recommended Posts

Posted (edited)

I found a script that claims to read registry keys into an array here:

I tried to read a registry key and it's giving me all the values, instead of only the "*AutoAdminLogon*" value I requested. The code I'm using is:

#RequireAdmin
#include <Array.au3>
#include <_RegEnumKeyValEx.au3>

Global $a, $Error, $Extended, $KeyName
$KeyName = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
$a = _RegEnumValEx($KeyName, 128 + 256 + 32, "*","*AutoAdminLogon*")
$Error = @Error
$Extended = @Extended
ConsoleWrite("Return = " & $a & " - $Error = " & $Error & " - $Extended = " & $Extended & @LF)
_ArrayDisplay($a)   ;Does not show number of entries displayed

Thanks,

Docfxit

All credit for the attached script goes to the author: DXRW4E

Edited by Docfxit
Posted

Please remove that code from you post and instead link to the UDF page. Have a little respect for UDF authors will you.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I have all the respect in the world.  That's why I gave him all the credit.  I thought it would be easier for someone to test my code.

I am very sorry if I didn't show enough respect.  I have removed it from my post.

Thanks for letting me know that was not appropriate.

Docfxit

Posted (edited)

Edit: Modified your first post?!
Don't expect much help like this

; Return values .: Success  - Return Array List (See Remarks)
;                  Failure - @Error
;                  |3 = Invalid $sFilter
;                  |4 = No Value-Name(s) Found
Edited by AutID
Posted

  On 10/30/2014 at 8:20 PM, AutID said:

 

Edit: Modified your first post?!

Don't expect much help like this

; Return values .: Success  - Return Array List (See Remarks)
;                  Failure - @Error
;                  |3 = Invalid $sFilter
;                  |4 = No Value-Name(s) Found

 

I found my first error before anyone else posted a resolution.  I fixed the error I found so I could get help on the remaining errors. 

In my first post I had 4 = No Value-Name(s) Found.

Thanks for you input,

Docfxit

  • Solution
Posted

I found the resolution to my question.

This is my current code that does work:

#RequireAdmin #include <Array.au3> 
#include <_RegEnumKeyValEx.au3> 
Global $a, $Error, $Extended, $KeyName 

$KeyName = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
$a = _RegEnumValEx($KeyName, 128 + 256 + 32, "AutoAdminLogon")
$Error = @Error
$Extended = @Extended
ConsoleWrite("Return = " & $a & " - $Error = " & $Error & " - $Extended = " & $Extended & @LF)
_ArrayDisplay($a)   ;Does not show number of entries displayed

Thank you,

Docfxit

Posted
  On 10/30/2014 at 8:19 PM, Docfxit said:

I have all the respect in the world.  That's why I gave him all the credit.  I thought it would be easier for someone to test my code.

I am very sorry if I didn't show enough respect.  I have removed it from my post.

Thanks for letting me know that was not appropriate.

Docfxit

Much appreciated, thanks. It's just duplicating code is bad news if the UDF is updated and then we have old outdated code laying around.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Thank you for the post.

  On 10/31/2014 at 3:39 AM, DXRW4E said:

Hi All, however for the info, Microsoft says it will do so http://support.microsoft.com/kb/128731 that should be in autoit '?do=embed' frameborder='0' data-embedContent>>

Ciao.

 

Thank you for the post.

If I understand you correctly,  I should be using SaveRegistryKey script instead of _RegEnumKeyValEx.au3 ?

Does that also have the capabilty to RestoreRegistryKey?

Thank you very much for your scripts.

Docfxit

Posted (edited)

Hi Docfxit,AutoIt Native Function are the fastest ehhhhh, but in this case have bugs, see the limit of 512 levels of the log regkeyname, so I think is better to use (SaveRegistryKey) RegistryEx.au3, it may be slower but more safer, however I've updated the RegistryEx.au3 added _WinAPI_RegRestoreKey

remember the main purpose of these scripts is more to show how to do something, after each user will be able to do even better, I mean even you yourself can checkeditupdateimprove the script, adapting it according to your requirements etc etc

 

Ciao.

Edited by DXRW4E

apps-odrive.pngdrive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

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
  • Recently Browsing   0 members

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