Moving Printers the Easy Way

Here's a script that I put together that allows network administrators to reconfigure client computers in a network printer migration scenario. Provided the client supports the Windows Script Host, this can be run as a logon script and the only requirement is that printers retain the same share name on the new server. Of course, you can modify the script as needed for your environment, but it certainly beats the manual configure of each workstation.

DIM oNet, oPrinters, x, sPrinter, sUNCPath, nUNCPath

'*** Create Network Object
Set oNet = CreateObject("WScript.Network")

'*** Create a Collection of Existing Printers on the Client
Set oPrinters = oNet.EnumPrinterConnections

For x = 0 to oPrinters.Count - 2 Step 2
'*** Get Printer Name
sPrinter = oPrinters(x)

'*** Get Printer Location
sUNCPath = oPrinters(x+1)

 '*** Check to see if Printer is on old server
If UCASE(LEFT(sUNCPath, 9)) = "\\SERVER1" Then 

  '*** If so, we must remove it and replace it
oNet.RemovePrinterConnection sUNCPath, true, true

'*** Add New Printer Location
nUNCPath = "\\SERVER23" & RIGHT(sUNCPath, LEN(sUNCPath)-9)
oNet.AddWindowsPrinterConnection nUNCPath
wScript.Echo "Printer: " & sPrinter
WScript.Echo "Changing Location from " & sUNCPath & " to " & nUNCPath

End If

Next