May 25, 2024

Printer Migration Script

Not sure if you’ve every had an issue where you have to move printers from one print server to another… I have had this come up a couple times…

Here’s a little vbs that can be executed from a logon script, that will look at a mapped printer’s connection (which server it is on), remove it, and then map it to another system.

Keep in mind, all the printers on NEWSERVER must have the same share names as the OLDSERVER.

Basically this script enumerates each printer, looks for the server it is mapped from, deletes the printer, and then adds the new printer, which happens to be the same printer, but mapped on a different server.

Here is the code:

On Error Resume Next
Dim strComputer
Dim objWMIService
Dim colItems
Dim WshNetwork

Set WshNetwork = WScript.CreateObject(“WScript.Network”)

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\” & strComputer & “rootcimv2”)
Set colItems = objWMIService.ExecQuery(“Select * from Win32_Printer”,,48)
For Each objItem in colItems
If objItem.ServerName = “\OLDSERVER” then
WshNetwork.RemovePrinterConnection objItem.ServerName & “” & objItem.ShareName, true, true
WshNetwork.AddWindowsPrinterConnection “\NEWSERVER” & objItem.Sharename
End If

If you want to download it, you can find it here.

As always, you are welcome to use the script, but I will not be held liable if any issues arise.

4 thoughts on “Printer Migration Script

  1. Is there anyway this script could be modified to change the local printer path? We setup local paths so the printer stays on the computer for whoever logs in.

  2. Very nice, simple script. I’ve looked at lots of scripts trying to migrate client printers and none of them have worked. Great job!

  3. Great Script! When i execute it manually it will work. Independent how i do this. (Doubleclick, cscript, wscript with batch file) The Script will change all connected printers.
    BUT when i do that from logon script it will not run clean. Only one or two printers will be changed. I tested many configurations. (call an second batch, with net start spooler, cscript, wscript, etc. – no setting have success.)
    Now i configured a msg box with a notice to start the vbs and open a folder with this file on start. But not every user unterstand this little step….

    Do u have any idea??

    1. Hrm… Been a while since I’ve had to use it… Not 100% sure.

      I may have to see about spinning it up again, as well as updating it for Win7/8…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.