Sign in to follow this  
Followers 0
usera

RegRead

12 posts in this topic

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

Share this post


Link to post
Share on other sites



is that possible rights (registry) issue? , if yes, how can I get that information?

Greeting,

Can anybody help me for the code below?

Local $var = RegRead("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstallWinRAR archiver", "UninstallString")

MsgBox(4096, "KEY", $var)

I am try to get the result "C:Program FilesWinRARuninstall.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_MACHINESOFTWAREMicrosoftWindowsCurrentVersion", "ProgramFilesDir")

MsgBox(4096, "Program files are in:", $var)

Thanks

usera

Share this post


Link to post
Share on other sites

Try using "HKLM" at the beginning instead of HKEY_LOCAL_MACHINE

Share this post


Link to post
Share on other sites

Thanks Colyn1337,

now it is:

Local $var = RegRead("HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstallWinRAR archiver", "UninstallString")

still same

Try using "HKLM" at the beginning instead of HKEY_LOCAL_MACHINE

Try using "HKLM" at the beginning instead of HKEY_LOCAL_MACHINE

Share this post


Link to post
Share on other sites

Try using "HKLM" at the beginning instead of HKEY_LOCAL_MACHINE

Why? They're both the same.

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Why? They're both the same.

I've had better luck with the shortname, there's a limit to how long the reg query string can be. Tho offhand I don't recall what it is.

@usera

is it a 64bit box? If so you'll want to use HKLM64

Also, add this code right after your regread() so maybe we can catch an error:

If @error Then msgbox(0, "error", @error)

if there's a number in the error text box, please post it.

Edited by Colyn1337
1 person likes this

Share this post


Link to post
Share on other sites

I've had better luck with the shortname, there's a limit to how long the reg query string can be.

Strange as I've never come across this issue.

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

Thanks colyn1337,

Changed to HKLM64 it works, yes it is 64 bit OS

Thanks

I've had better luck with the shortname, there's a limit to how long the reg query string can be. Tho offhand I don't recall what it is.

@usera

is it a 64bit box? If so you'll want to use HKLM64

Also, add this code right after your regread() so maybe we can catch an error:

If @error Then msgbox(0, "error", @error)

if there's a number in the error text box, please post it.

Share this post


Link to post
Share on other sites

Always a pleasure.....

Happy scripting!

Share this post


Link to post
Share on other sites

Always a pleasure.....

Happy scripting!

Thanks again,

How or where you get the hklm64 information?

Share this post


Link to post
Share on other sites

Help file surprisingly.

When running on 64-bit Windows if you want to read a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

Help file surprisingly.

why this one ok?

Local $var = RegRead("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion", "ProgramFilesDir")

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  
Followers 0

  • Similar Content

    • Cirusnb
      By Cirusnb
      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. 
    • AutID
      By AutID
      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?
    • u01jmg3
      By u01jmg3
      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 EndFunc How 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
    • fmlk
      By fmlk
      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:  
    • Colyn1337
      By Colyn1337
      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?