Here's something I ran in our environment when we migrated print servers. It ran with a lot of success. Includes methods for redirecting network printers on 9x machines too.

Below is the test script I ran before integrating it in the login script...

code:
Break On CLS

Dim $,$ticks,$rc

$ticks=@ticks
$rc = fnRemapPrinters("old_server","new_server")
;$rc = fnRemapPrinters("new_server","old_server")
? @ERROR ":" @SERROR

?? "Remapped "+ $rc + " Printers in "+(@ticks-$ticks)/1000+" seconds."
?? "Press any key to exit."
Get $

If @INWIN=2 and $RC
$nul=MESSAGEBOX ("Your settings have been changed. A reboot is required", "Relizon", 0)
RUN "%WINDIR%\RUNDLL32.EXE SHELL32.DLL,SHExitWindowsEx 2"
RUN "%WINDIR%\RUNDLL32.EXE USER.EXE,ExitWindowsExec"
EndIf
get $
Exit 1


Function fnRemapPrinters($sOldServer,$sNewServer)
Dim $lIndex,$NUL,$Err,$sDefault,$sDevice,$sDevices,$sPort,$sPorts,$sPrinter,$sPrinterPorts,$sServer
Dim $sPrinters[100]
$fnRemapPrinters=0
$lIndex=0
If @INWIN=1
$sPorts="HKCU\Printers\Connections\"
$sDefault=Split(ReadValue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),",")[0]
;"Installed Printers:" ?? ; Debug
Do
$sPrinters[$lIndex]=EnumKey($sPorts,$lIndex)
$lIndex=$lIndex+1
If Ubound($sPrinters)=$lIndex Redim Preserve $sPrinters[Ubound($sPrinters)+100] EndIf
Until @ERROR
Redim Preserve $sPrinters[$lIndex-1]
For $lIndex = 0 to Ubound($sPrinters)
$sServer=ReadValue($sPorts+$sPrinters[$lIndex],"Server")
;"Printer: "+$sPrinters[$lIndex]+" Server: "+$sServer ? ; Debug: Lists installed network printers.
If SUBSTR($sServer,3,LEN($sServer))=$sOldServer
$sPrinter=Split($sPrinters[$lIndex],",")[3]
$NUL=AddPrinterConnection("\\"+$sNewServer+"\"+$sPrinter)
If @ERROR
;"AddPrinterConnection Failed: "+@ERROR" : "+@SERROR ; Debug: Printers error msg
$Err=@ERROR
Else
If $sDefault="\\"+$sOldServer+"\"+$sPrinter
$NUL=SetDefaultPrinter("\\"+$sNewServer+"\"+$sPrinter)
EndIf
$NUL=DelPrinterConnection("\\"+$sOldServer+"\"+$sPrinter)
If @ERROR $Err=@ERROR EndIf
$fnRemapPrinters=$fnRemapPrinters+1
EndIf
EndIf
Next
Else
$sPorts="HKLM\System\CurrentControlSet\control\Print\Printers\"
Do
$sPrinters=EnumKey($sPorts,$lIndex)
If $sPrinters
$sPort=ReadValue($sPorts+$sPrinters,"Port")
If Split($sPort,"\")[2]=$sOldServer
$sPrinter=Right($sPort,Len($sPort)-Len($sOldServer)-2)
$NUL=WriteValue($sPorts+$sPrinters,"Port","\\"+$sNewserver+$sPrinter,"REG_SZ")
If @ERROR $Err=@ERROR EndIf
$sDevice=Split(ReadProfileString("Win.ini","Windows","Device"),",")
If $sDevice[2]=$sPort
$NUL=WriteProfileString("Win.ini","Windows","Device",
$sDevice[0]+","+$sDevice[1]+","+"\\"+$sNewserver+$sPrinter)
If @ERROR $Err=@ERROR EndIf
EndIf
$NUL=WriteProfileString("Win.ini","Ports",$sPort)
$NUL=WriteProfileString("Win.ini","Ports","\\"+$sNewserver+$sPrinter," ")
If @ERROR $Err=@ERROR EndIf
$sPrinterPorts=Split(ReadProfileString("Win.ini","PrinterPorts",$sPrinters),",")
$NUL=WriteProfileString("Win.ini","PrinterPorts",$sPrinters,
$sPrinterPorts[0]+","+"\\"+$sNewserver+$sPrinter+","+$sPrinterPorts[2]+","+$sPrinterPorts[3])
If @ERROR $Err=@ERROR EndIf
$sDevices=Split(ReadProfileString("Win.ini","Devices",$sPrinters),",")
$NUL=WriteProfileString("Win.ini","Devices",$sPrinters,$sDevices[0]+","+"\\"+$sNewserver+$sPrinter)
If @ERROR $Err=@ERROR EndIf
If Not $Err $fnRemapPrinters=$fnRemapPrinters+1 EndIf
EndIf
EndIf
$lIndex=$lIndex+1
Until $sPrinters=""
EndIf
If Not $Err $Err=0 EndIf
Exit $Err
EndFunction



[ 15. September 2003, 22:20: Message edited by: Chris S. ]