Search the Community
Showing results for tags 'RegRead'.
-
I'm writing a little applet that basically tells you when Windows was installed. There is a REG_DWORD in Windows that gives you this. It's basically a value that is the # of seconds from 1970. The location is: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate" So if I run this in AutoIT, I should get the value displayed within the msgbox: MsgBox($MB_SYSTEMMODAL, "InstallDate Test", RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "InstallDate")) However, what happens is it always returns a value of "0" I tried this on several machines (Windows 8, Windows 8.1 and Windows 10). Am I missing something? If I manually view this REG_DWORD with RegEdit, it shows me the HEX value, or I can view the Decimal value. I don't care which value AutoIT reads, as I can always convert back and forth, but I just don't see why it can't read a value from this REG_DWORD. As a test, I've read other REG_DWORD values, and with most it doesn't return any value, not even a 0. Please, even if you guys have some other (perhaps better) way to read the Windows install date, I would still like to find a resolution to this problem, because I want to understand why I am having so much difficulty with reading REG_DWORD values from the Windows Registry with AutoIT. Thanks for any help!
-
Hi This piece of code creates and reads OK a key at "HKEY_LOCAL_MACHINE" and can be changed for a key at "HKEY_CURRENT_USER" $sta= RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor", "wav", "REG_SZ", "5555") MsgBox(4096,"wrote", $sta &@cr& @error) $zz= RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor", "wav") MsgBox(4096,"readed","="&$zz &@cr& @error) Exit With HKEY_CURRENT_USER, in RegEdit we can see the created key, and we can create the key by hand/RegEdit and everything Works OK. At HKEY_LOCAL_MACHINE we can´t see the created key above thru RegEdit, but it Works (even not seeing, I can read). But if I create "by hand"/RegEdit the key, it can´t read it with $zz= RegRead ("HKEY_LOCAL_MACHINE.... above. I´m the PC´s WIN.7 administrator. Even so I ran RegEdit as administrator and also the compiled AU3 and also plain. No changes. edit: even if Try "HKEY_LOCAL_MACHINE\SOFTWARE\AAA", "wav", the same holds true. $sta= RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\AAA", "wav", "REG_SZ", "4444") MsgBox(4096,"wrote", $sta &@cr& @error) $zz= RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\AAA", "wav") MsgBox(4096,"readed","="&$zz &@cr& @error) Exit Seems that it creates this key at another place.... I can read the above value ("4444"), even after a boot, even the key not showing in regedit. And if I create it by hand key AAA/wav with a distinct value (666), t, it continues Reading the old value = 444. Thanks Jose
-
I want to determine if AutoLogon is enabled on a Windows 10 Pro (64-bit) system. It's my understanding that the following registry key will exist and equal 1 if autologon is enabled, or equal 0 if disabled. Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon So l looked up RegRead in AutoIt's help file and tested the example. #include <MsgBoxConstants.au3> Local $sVar = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") MsgBox($MB_SYSTEMMODAL, "Program files are in:", $sVar) The resulting message box says: C:\Program Files (x86) Regedit says the value in ProgramFilesDir is C:\Program Files. "C:\Program Files (x86)" is in a nearby key "ProgramFilesDir(x86)", which makes sense. I ignored this anomaly and tried RegRead in my own script: #include <MsgBoxConstants.au3> $isEnabled = RegRead("Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon") If $isEnabled = 1 then MsgBox($MB_SYSTEMMODAL, "", "Autologon enabled.") Else MsgBox($MB_SYSTEMMODAL, "", "Autologon disabled.") EndIf My punishment for ignoring the problem with the Help file example is that regardless of whether the AutoAdminLogon key equals 0 or 1 in reality, my script's $isEnabled variable returns 0. Despite the problem with the RegRead example I still figure I'm at fault, but I would appreciate someone pointing out my mistake, please.
-
Hi all, first post here ever, I'm working on a project, Helpdesk type tool. I'm trying to set the State (Checked, Unchecked) of check boxes, and Or button, (a Toggle). this would be set by determining the Value of Certain Reg keys, here is my phone below. $PC_select_data is the Computer Name so you could replace it with "@Computer". I looked and looked and couldn't find whats wrong. I'm new to Autoit somewhat. I may be complicating things by assigning Arrays for my controls, but I think this will work. the first part is fine, I get a Computer from a list (that I got from AD with Water's Awesome UDF) please not I'm using onevent also, well. the UDF OnEventA that allows upto 4 ByVal or Ref's I get the Value $PC_selected_data return the value to the Function I send a test Key with Regread, if I can't read it I launch sc.exe to run Remote Reg. Then I read 5 values from the Remote Reg. I assigned a Array of those Values and Also Assigned a Array of my CheckBoxes also. Now my logic, if the Value of the REG key is "" (blank) then UnCheck all the check boxes, else, Check them. Now, to make this more efficient, I put the Controls in an Array, of the Same Lenth. now here is the think, I run my script, it runs fine, finds the value, and Un-checks all of the check boxes, now if I go change one of the REG values, it does not Check them. because of the Logic for the For Loop. I would have figured that If the first value of the Array $Run_as_MSIscheck = somevalue that it would see that as a "ELSE" and Check the box. Since the For loop contains the If - then- Else, but I Understand that it only runs the first Block, IF the condition is True. So I guess Am I totally off track? Func Check_PC_status($PC_select_Data) local $pingPC local $regtemp = "" local $x = "" local $Run_as_MSIcheck,$Run_as_CMDcheck,$Run_as_BATCheck,$Run_as_REGcheck local $RUNas_chks[4] = [$MSI_runAs_chk,$CMD_runAs_chk,$BAT_runAs_chk,$REG_runAs_chk] local $runAS_function_check[4] = [$Run_as_MSIcheck,$Run_as_CMDcheck,$Run_as_BATCheck,$Run_as_REGcheck] ;~ @error: ;~ 1 = Host is offline ;~ 2 = Host is unreachable ;~ 3 = Bad destination ;~ 4 = Other errors ;Sends Ping to pc to see if its live or not. $pingPC = ping($PC_select_Data,2000) ;if Ping has returned a good value, NOT 0. check current status of the following lines in registry. checkes for RunAS for CMD/MSI/BAT and Remote REG keys. checks for SMS prompt control. if $pingPC Then ;tries to read a key from the registry, and returns its value, if its blank, $regtemp = RegRead("\\" & $PC_select_Data & "\HKLM\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control", "Permission Required") ConsoleWrite("Sending test Key, is set to: " & $regtemp & @CRLF) ;~error: 3 = Bad destination if @error = 3 or $regtemp = "" Then ConsoleWrite("Unable to determine status of remote registry!!!" & @CRLF & "Trying to start Remote Registry.... via Service Control Manager" & @CRLF ) RunWait(@SystemDir & '\sc.exe \\' & $PC_select_Data & ' start RemoteRegistry',"","") if Not @error then ConsoleWrite("Remote Registry loaded" & @CRLF & @CRLF) EndIf EndIf TCPStartup() $IPadd = TCPNameToIP ($PC_select_Data) ConsoleWrite($IPadd & @CRLF) TCPShutdown() ConsoleWrite("ping Success: " & $pingPC & "ms" & @CRLF) $Sccm_PROMPTcheck = RegRead("\\" & $PC_select_Data & "\HKLM\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control", "Permission Required") $Run_as_MSIcheck = RegRead("\\" & $PC_select_Data & "\HKEY_CLASSES_ROOT\Msi.Package\shell\runas\command", "") ; MSI access Check $Run_as_CMDcheck = RegRead("\\" & $PC_select_Data & "\HKEY_CLASSES_ROOT\cmdfile\shell\runas\command", "") ; CMS access Check $Run_as_BATCheck = RegRead("\\" & $PC_select_Data & "\HKEY_CLASSES_ROOT\batfile\shell\runas\command", "") ; BAT access Check $Run_as_REGcheck = RegRead("\\" & $PC_select_Data & "\HKEY_CLASSES_ROOT\regfile\shell\runas\command", "") ; REG access Check ConsoleWrite("SMS Client status: " & $Sccm_Promptcheck & @CRLF & "MSI RunAS Status: " & $Run_as_MSIcheck & @CRLF & "CMD RunAs Status: " & $Run_as_CMDcheck & @CRLF & "BAT RunAs Status: " & $Run_as_BATCheck & @CRLF & "REG RunAs Status: " & $Run_as_REGcheck & @CRLF & @CRLF) for $x = 0 to UBound($runAS_function_check) -1 ConsoleWrite("Count: " & $x & @CRLF) if $runAS_function_check[$x] = "" Then $test1 = guictrlread($RUNas_chks[$x]) ConsoleWrite("B4 " & $test1 & @CRLF) GUICtrlSetState($RUNas_chks[$x],$GUI_UNCHECKED) $test2 = guictrlread($RUNas_chks[$x]) ConsoleWrite("After " & $test2 & @CRLF) Else GUICtrlSetState($RUNas_chks[$x],$GUI_CHECKED) EndIf Next Else ConsoleWrite($PC_select_Data & " is Not reachable" & @CRLF & @CRLF) EndIf Endfunc any help is appreciated.
-
Hello, I with @SmOke_N 's help found the answer to this question in this thread: https://www.autoitscript.com/forum/topic/166384-regread-read-saved-credentianls-from-ie/ Now this was working fine until lately. I updated from Windows 7 ultimate to Windows 8.1 Pro. And this small sample doesn't seem to work anymore. Here is the code from the old thread: #include <APIRegConstants.au3> #include <Array.au3> #include <WinAPIDiag.au3> #include <WinAPIReg.au3> #include <Crypt.au3> Global $gsValName, $giType Global $giCount = 0 Global $gaInfo[101][3] Global $sPath = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IntelliForms\Storage2" Global $aPath = "Software\Microsoft\Internet Explorer\IntelliForms\Storage2" Global $ghKey = _WinAPI_RegOpenKey($HKEY_CURRENT_USER, $aPath, $KEY_READ) While 1 $gsValName = _WinAPI_RegEnumValue($ghKey, $giCount) If @error Then ExitLoop $giType = @extended If Mod($giCount, 100) = 0 Then ReDim $gaInfo[$giCount + 100][3] EndIf $gaInfo[$giCount][0] = $gsValName $gaInfo[$giCount][1] = $giType $gaInfo[$giCount][2] = BinaryToString(_Crypt_DecryptData(RegRead($sPath, $gsValName), "", $CALG_3DES)) ;$CALG_USERKEY $giCount += 1 WEnd _WinAPI_RegCloseKey($ghKey) ReDim $gaInfo[$giCount][3] _ArrayDisplay($gaInfo) When I manually checked the registry in this path HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IntelliForms\Storage2 my credentials aren't saved there anymore. Does anyone know the right path to the IE's saved credentials?
-
HotKeySet("^``", "toggle_media_controls") ; Ctrl + ` While 1 Sleep(100) WEnd If Not ProcessExists("wmplayer.exe") And RegRead("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled") = 1 Then ; Disable autohide controls RegWrite("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled", "REG_DWORD", "0") EndIf Func toggle_media_controls() Local $sVar = RegRead("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled") If ProcessExists("wmplayer.exe") Then If $sVar = 0 Then ; Enable autohide controls RegWrite("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled", "REG_DWORD", "1") Else ; Disable autohide controls RegWrite("HKCU\Software\Microsoft\MediaPlayer\Preferences", "HoverTransportsEnabled", "REG_DWORD", "0") EndIf EndIf EndFuncHow do I amend this code so that without pressing a hotkey, after Windows Media Player is not running, the regkey above is set to 0? My function and hotkey all work without issue
- 9 replies
-
- processexists
- regread
-
(and 2 more)
Tagged with:
-
L.S. Not all registry keys are read. And that is nuisance when some keys are nice checks for existance of certain application. See below a litle test script and the output. Why is output of test 3 and 4 empty?? $test = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\ThinPrint", "Lang") ConsoleWrite("test1: " & $test & @CR) $test2 = Regread("HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications", "Wordpad") ConsoleWrite("test2: " & $test2 & @CR) $test3 = Regread("HKEY_LOCAL_MACHINE\SOFTWARE\CBSTEST", "CBSTestWTTLogFile") ConsoleWrite("test3: " & $test3 & @CR) $test4 = Regread("HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip", "Path") ConsoleWrite("test4: " & $test4 & @CR) Output: test1: enu test2: Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad\Capabilities test3: test4:
- 3 replies
-
- regread
- hklm\software\
-
(and 1 more)
Tagged with:
-
This code loads the result of a regread into a variable and then parses the result: $RegResult = RegRead($HKLM & "\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters", "AutoShareWks") Select Case $RegResult = "" $RegWriteResult = RegWrite($HKLM & "\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters", "AutoShareWks", "REG_DWORD", "0") TrayTip("Registry Read", "AutoShareWks Reg key not found and was created. The read result was: " & $RegResult & " " & @error & _ ". The write result was: " & $RegWriteResult & " " & @error, 5) Case $RegResult = "0" ; 0 indicates sharing is off TrayTip("Registry Read", "Auto Drive Sharing is currently DISABLED.", 5) Case $RegResult = "1" ; 1 indicates sharing is on TrayTip("Registry Read", "Auto Drive Sharing is currently ENABLED", 5) EndSelect The problem is that the value of AutoShareWks is boolean and either 1 or 0. The documentation for regread states that if failure of the regread, "" is returned. However it seems to also interpret 0 as "" and trigger a false failure. Even @error has the same issue. If the reading value is 0, @error will trigger. So, how can I get around this false failure trigger? EDIT: I figured out a work around like this: $RegResult = RegRead($HKLM & "\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters", "AutoShareWks") Select Case $RegResult = "0" ; 0 indicates sharing is off TrayTip("Registry Read", "Auto Drive Sharing is currently DISABLED.", 5) Case $RegResult = "1" ; 1 indicates sharing is on TrayTip("Registry Read", "Auto Drive Sharing is currently ENABLED.", 5) Case Else ; Default Actions TrayTip("Registry Read", "AutoShareWks value not present in registry. Auto Drive Sharing is currently ENABLED.", 5) EndSelect However, still....... Why is the error process not catching it correctly?
-
Greeting, Can anybody help me for the code below? Local $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinRAR archiver", "UninstallString") MsgBox(4096, "KEY", $var) I am try to get the result "C:\Program Files\WinRAR\uninstall.exe" which I can get from Regedit. but for some reason, the msgbox show me nothing just the title "KEY" BUT: in same time, the demo code work, Local $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") MsgBox(4096, "Program files are in:", $var) Thanks usera
-
Hi I hope someone can clarify an issue that I am having with regread reporting under W7 were I have administrative rights on the machine The situation is that I am performing the following code in a for loop against an ini file under but I am getting contradictory results depending on whether I engage UAC for the script $Transaction = RegWrite($vidBranchPath & "\" & $iniFileSectionUSB[$i][1]) $Transaction = RegRead($vidBranchPath & "\" & $iniFileSectionUSB[$i][1], "") If I run the script without UAC the script does not error branch even though the previous regwrite has not successfully completed the write task. If I engage UAC the registry entries are created. My concern is not that the entries are not being created but that under non-UAC the regread is reporting their existence.