Home > Windows > Printer Migration Script

Printer Migration Script

December 16, 2008 Leave a comment Go to comments

On a number of occasions I have had to migrate Windows Print servers.  This task is easy using Printmig, a little free application provided by Microsoft that allows you to backup all the print queues, drivers and settings and restore them to a new server.  The challenge arises when you want to update the client PCs as well, especially when you have many to do.

There are a number of scripts available on the net for this and here is the one I have found very useful.  It obtains the list of all the printers installed on the client, deletes them all and remaps them to the new print server.

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

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

    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
    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
    Next

Categories: Windows
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment