2 replies
by arne.tredal
We have used the following kixtart script to do a similar function;
$Mark = READVALUE("HKEY_CURRENT_USER\Printers","completed")
if $Mark = "completed"
QUIT
endif
;;SYSTEM DEFINED VALUES
$DEBUG = "NO"
$INIStore = "@LDRIVE\ReMapPRT.INI"
$PRINT = "HKEY_CURRENT_USER\Printers\Connections\"
$DEFPRT = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows"
$PRIMARYINDEX = 0
;; Get the users default printer
IF (existkey($DEFPRT) = 0)
$default_printer=ReadValue($DEFPRT, "device")
ELSE
$default_printer=""
ENDIF
;;To find all installed printers, we need to enumerate through the registry
;;to see what's installed
DO
$PORT = ""
$NEWPORT = ""
$KEY = ENUMKEY($PRINT,$PRIMARYINDEX)
If $KEY <> ""
$PORT = READPROFILESTRING("$INIStore","$KEY","OldPort")
If $PORT <> ""
$NEWPORT = ReadProfileString("$INIStore","$KEY","NewPort")
If $NEWPORT <> ""
If DelPrinterConnection ($PORT) = 0
? "Deleted printer connection....$PORT"
If AddPrinterConnection ($NEWPORT) = 0
? "Added printer connection....$NEWPORT"
If (InStr(UCase($default_printer), $PORT) <> 0)
If SetDefaultPrinter ($NEWPORT) = 0
? "Changed default printer to....$NEWPORT"
EndIf
EndIf
$PRIMARYINDEX = -1
EndIf
EndIf
EndIf
EndIf
EndIf
IF $DEBUG = "YES"
? "Next primary index: $PRIMARYINDEX"
? "Print key found: $KEY"
? "PORT value found: $PORT"
? "NewPORT value found: $NewPORT"
EndIf
$PRIMARYINDEX= $PRIMARYINDEX + 1
UNTIL $KEY= ""
$null = WRITEVALUE("HKEY_CURRENT_USER\Printers","Remap","completed",REG_SZ)
Example "ReMapPrint.ini":
[,,OldServer,OLdQueue]
OldPort=\\OLDSERVER\oldqueue
NewPort=\\NEWSERVER\newqueue
by lundb
The Win2K RK was updated and there is a new version of PRNMGR which seems to work.
There is an NT4 RK tool CHHPRINT.EXE when used within a login script or an SMS Advertisement also works.
This discussion is closed to new replies.
Trending Windows Forum posts
Sort by Trending