There is a vb script I found on the Internets, it’s very handy.
You run this against your users, upon logon, and you can run it multiple times (after the first time it doesn’t change anything). It looks in the registry on the workstation and finds the mapped printers, parses it, and changes the old name to the new name. It’s important when migrating printers to not change the name of the shared printer, otherwise this won’t work. It’s a silent script, no popups.
I called my file pmigrate.vbs, and you can run it from group policy login script, or from a batch file with this line“cscript.exe \\domain.local\netlogon\pmigrate.vbs” Hint: Use the FQDN of active directory, and copy the vb script into the netlogon share.
I found other scripts, some that remove and reinstall printers, but that takes a long time. What is nice about this script is that it runs silent and it works flawlessly. After a while, a couple of day, you disable the running of it.
Dim from_sv, to_sv, PrinterPath, PrinterName, DefaultPrinterName, DefaultPrinter
Dim DefaultPrinterServer, SetDefault, key
Dim spoint, Loop_Counter
Dim WshNet, WshShell
DefaultPrinterName = ""
spoint = 0
SetDefault = 0
set WshShell = CreateObject("WScript.shell")
from_sv = \\old ‘This should be the name of the old server.
to_sv = \\new ‘This should be the name of your new server.
‘Just incase their are no printers and therefore no default printer set
‘ this will prevent the script form erroring out.
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)
Set WshNet = CreateObject("WScript.Network")
Set WS_Printers = WshNet.EnumPrinterConnections
‘You have to step by 2 because only the even numbers will be the print queue’s
‘ server and share name. The odd numbers are the printer names.
For Loop_Counter = 0 To WS_Printers.Count – 1 Step 2
‘Remember the + 1 is to get the full path ie.. \\your_server\your_printer.
PrinterPath = lcase(WS_Printers(Loop_Counter + 1))
‘We only want to work with the network printers that are mapped to the original
‘ server, so we check for "\\Your_server".
if LEFT(PrinterPath,len(from_sv)) = from_sv then
‘Now we need to parse the PrinterPath to get rhe Printer Name.
spoint = instr(3,PrinterPath,"\")+1
PrinterName = mid(PrinterPath,spoint,len(PrinterPath)-spoint+1)
‘Now remove the old printer connection.
‘and then create the new connection.
‘If this printer matches the default printer that we got from the registry then
‘ set it to be the default printer.
if DefaultPrinterName = PrinterName then
Set WS_Printers = Nothing
Set WshNet = Nothing
Set WshShell = Nothing