Here is the Code. All I want is to change the name of the key. Simply rename it.

code:
:GetKey

$KeyName = EnumKey($HomeKey,$index) ;read the next printer name

CHR(13) + CHR(10); carriage return line feed for debugging purposes only
if @error = 0
$FullKey = $HomeKey + "\" + $KeyName
;get the full path for the printer registry key
$Port = READVALUE($FullKey,"Server")
;get the port for current printer

;if the old server name is in the port, replace it with the new server name
if INSTR($PORT,$OLDSVR)
$Prt = SUBSTR($PORT,$L + 3,0 )
;separate the printer share name from the port name
$NewPort = "\\" + $NEWSVR + $Prt
;generate new port using new server and printer share
WriteValue($FullKey,"Server",$NewPort,"REG_SZ")
;write this new port to the registry

if @ERROR = 0 ;if successful, write to the log file
OPEN(2,"C:\Winnt\PrintMig.log",5)
WRITELINE(2,"Successfully moved printer " + $Prt + " from " + $OLDSVR + " to " + $NEWSVR +Chr(13) +Chr(10))
$count = $count + 1 ;increase the count of printers migrated
else
BEEP
? "There was an error redirecting your printers. Please contact the Help Desk."
OPEN(2,"C:\Windows\PrintMig.log",5)
WRITELINE(2,"Errors while moving printer " + $Prt + " from " + $OLDSVR + " to " + $NEWSVR +Chr(13) +Chr(10))
endif
endif
$index = $index + 1 ;increment index for next pass
goto GetKey ;loop and read next printer
Endif
; --------------------------------------------------------------;
; ----------- End section Enumerate Printer Ports --;
; --------------------------------------------------------------;

:END

EXIT 0

(MCA: add CODE tages)

[ 18. February 2003, 17:53: Message edited by: MCA ]