Shadster Posted December 20, 2011 Posted December 20, 2011 Hi All, Trying to change a couple regkeys in which the full key name is dynamic from build to build and i am not sure how to really parse it. need to change the dword value of "NetbiosOption" to "1" if it exists under this tree: HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_{xyz123-12-345-7890} problem is that the guid... part inside of the curly brackets changes... {xyz123-12-345-7890} from machine to machine with same hardware/image etc...) so how can i just look for "Tcpip_{* or wildcard equivalent in this branch and then edit it if it is there? or should i just change my logic and search the reg for the NetbiosOption key and if exists change it to 1? not sure i like the blanket approach since i know that i only want to change the ones under this 'branch' or should I have it read and set then return values to a variable(s) and then pump it back via something like:" RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\$Variable", "NetbiosOption","Reg_DWORD", "1" )
Shadster Posted December 21, 2011 Author Posted December 21, 2011 (edited) yeah, they are for each nic connection... so i have it reading them, and kicking it to a msg box, and some tenative logic below... but obviously i have some errors when i go to pass it to a the value, and then read the key if a 0 or 1... as well as catching the error if that sub-key (NetbiosOptions) does not exist $Path = String("HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNetBTParametersInterfaces") For $i= 1 to 10 $var = RegEnumKey($Path, $i) If @error <> 0 then ExitLoop MsgBox(4096, "Tcpip_{xxx} #" & $i & " under HKLMSYSTEMCurrentControlSetServicesNetBTParametersInterfaces: ", $var) also not sure on if i need the backtrailing slash for the RegEnumVal: something like this to get that value (then determine if a 0 --change it, else next) but keeps showing blank so not setting/reading it yet... maybe a missing blackslash i.e. $Path''&$var $val = RegEnumVal($Path1&$var, "NetbiosOptions") MsgBox(4096, "testwindows", $val) Edited December 21, 2011 by Shadster
Country73 Posted December 21, 2011 Posted December 21, 2011 Something like this: $Path = String("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\") For $i= 1 to 10 $var = RegEnumKey($Path, $i) If @error <> 0 then ExitLoop $Search_Val = RegRead($Path & $var,"NetbiosOptions") If Not @error Then ConsoleWrite($i & @TAB & $var & @TAB & "DWORD: " & $Search_Val & @CRLF) Else ConsoleWrite($i & @TAB & $var & @TAB & "Not Found" & @CRLF) EndIf Next If you try to fail and succeed which have you done?AutoIt Forum Search
Shadster Posted December 21, 2011 Author Posted December 21, 2011 ahh... so clean and elegant. thank you so much! mine was close but starting to get 'ugly!!' thanks for giving me a good clean example... happy holidays!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now