shornw Posted July 23, 2008 Posted July 23, 2008 Hi I am de commissioning a server and moving the data to another. Unfortunately the majority of users have drives mapped locally on their PC's which will have to be re-mapped to the new location. My thinking was along these lines: read the key into an array (RegEnumKey), compare the value and overwrite if match occurs. I used the RegEnumKey example as a basis and added a RegRead but it isn't working at all. Can anyone offer any ideas? thx For $i= 1 to 10 $var = RegEnumKey("HKEY_CURRENT_USER\Network\", $i) If @error <> 0 then ExitLoop _read() Next Func _read() $dr1 = RegRead("HKEY_CURRENT_USER\Network\" & $i, "RemotePath") MsgBox(0, "Test", $dr1) EndFunc [font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]
ProgAndy Posted July 23, 2008 Posted July 23, 2008 1) You have to use the fetched key, not the counter variable 2) use Function Parameters muttley 3) use a while-loop, so the amount of keys is not limited $i = 0 While 1 $i += 1 $var = RegEnumKey("HKEY_CURRENT_USER\Network\", $i) If @error <> 0 then ExitLoop _read($var) WEnd Func _read($key) $dr1 = RegRead("HKEY_CURRENT_USER\Network\" & $key, "RemotePath") MsgBox(0, "Test", $dr1) EndFunc *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
shornw Posted July 23, 2008 Author Posted July 23, 2008 Hi ProgAndy, Thanks for this, it has pointed me in the right direction at least, however I still have a bit of a problem...maybe you could help. I added to your script to re write the value but for some reason it isn't doing it. Am I missing something obvious/being stupid/not getting the point here (del as necessary) thx again $old = "\\intranet\it_mgmt" $new = "\\newsvr\newshare" $i = 0 While 1 $i += 1 $var = RegEnumKey("HKEY_CURRENT_USER\Network\", $i) If @error <> 0 then ExitLoop _read($var) WEnd Func _read($key) $dr1 = RegRead("HKEY_CURRENT_USER\Network\" & $key, "RemotePath") If $dr1 = $old Then RegWrite("HKEY_CURRENT_USER\Network\" & $key & "\Remotepath", "REG_SZ", $new) MsgBox(0, "Test", $dr1) EndIf EndFunc [font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]
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