|
I'm trying to remap persistant drive mappings from various server shares to new ones. I start by enumerating the persistant drive mapping keys through the registry, reading the remote path and if the first part equals the name of the server I'm looking for, delete it and remap to the new server as the same drive letter using the the new server name followed by whatever path was read. The use command doesnt seem to like the use of variables. Can anyone help? I've included a sample of what I got. I'm using Case select because I will be remapping shares off various servers. Thx ***************************************************************
$Index = 0
:Loop1
$KeyName = ENUMKEY("HKEY_CURRENT_USER\Network\", $Index)
If @ERROR = 0 $MappedServer = ReadValue("HKEY_CURRENT_USER\Network\$KeyName", "RemotePath") $Drive = ltrim(substr($MappedServer,1,14)) $Path = ltrim(substr($MappedServer,15,255)) $Drive1 = ltrim(substr($MappedServer,1,13)) $Path1 = ltrim(substr($MappedServer,14,255))
SELECT
Case $Drive = "\\oldserver"
use $KeyName: /delete /PERSISTENT use $KeyName: "\\newserver\$Path" /persistent
ENDSELECT
$Index = $Index + 1 goto Loop1 Endif
|