Here is a script I used a few months ago it is very useful if you are moving or changing the name of your printer server. The script looks at the current users installed network printers which are retrieved for example as;


If the name of the server matches the variable “from_sv” the printer is removed from the user and a new printer is added using the “to_sv” variable from example if the “to_sv” variable was set to “\\newprintserver;

\\ newprintserver \hrprinter
\\ newprintserver \copier1

The script does not create a queue on the new print server it just removes any reference to the old print server and as long as a queue exists on the new server it adds the printer back on for the user pointing at the new server.

To move all of you printer queue, drivers and ports from one server to another take a look at Microsoft’s free tool Print Migrate

This script works great if called from a logon script! And also works fine on Citrix

Sometimes doing a big bang migration from an old print server to a new one is not the best idea, if you would prefer a more granular approach take a look at this script

Dim from_sv, to_sv, PrinterPath, PrinterName, DefaultPrinterName, DefaultPrinter

Dim DefaultPrinterServer, SetDefault, key

Dim spoint, Loop_Counter

Dim WshNet, WshShell

Dim WS_Printers

DefaultPrinterName = ""

spoint = 0

SetDefault = 0

set WshShell = CreateObject("")

from_sv = "\\printserver1" 'This should be the name of the old server.

to_sv = "\\newprintserver" 'This should be the name of your new server.

'Make sure there are printers installed

On Error Resume Next

key = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"

DefaultPrinter = LCase(WshShell.RegRead (key))

If Err.Number <> 0 Then

DefaultPrinterName = ""


'If the registry read was successful then parse out the printer name so we can

' compare it with each printer later and reset the correct default printer

' if one of them matches this one read from the registry.

spoint = instr(3,DefaultPrinter,"\")+1

DefaultPrinterServer = left(DefaultPrinter,spoint-2)

if DefaultPrinterServer = from_sv then

DefaultPrinterName = mid(DefaultPrinter,spoint,len(DefaultPrinter)-spoint+1)

end if

end if

Set WshNet = CreateObject("WScript.Network")

Set WS_Printers = WshNet.EnumPrinterConnections

For Loop_Counter = 0 To WS_Printers.Count - 1 Step 2

PrinterPath = lcase(WS_Printers(Loop_Counter + 1))

if LEFT(PrinterPath,len(from_sv)) = from_sv then

spoint = instr(3,PrinterPath,"\")+1

PrinterName = mid(PrinterPath,spoint,len(PrinterPath)-spoint+1)

WshNet.RemovePrinterConnection from_sv+"\"+PrinterName

WshNet.AddWindowsPrinterConnection to_sv+"\"+PrinterName

if DefaultPrinterName = PrinterName then

WshNet.SetDefaultPrinter to_sv+"\"+PrinterName

end if

end if


Set WS_Printers = Nothing

Set WshNet = Nothing

Set WshShell = Nothing