Jump to content

How to save Registry keys


Docfxit
 Share

Go to solution Solved by Docfxit,

Recommended Posts

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

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:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

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

Link to comment
Share on other sites

  • Solution

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

Link to comment
Share on other sites

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:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Thank you for the post.

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

Link to comment
Share on other sites

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

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...