Print Server Migration

Downloads
40882.zip

When you conduct a print server migration, you must consider the best method for moving your users off the old print servers and onto the new servers. You can manually change each user's installed printers, although this task is time-consuming. Alternatively, you can use a third-party tool or logon scripting with Active Directory's (AD's) Group Policy to automatically install new printers.

Automatic methods typically involve giving users access to the new printers without limiting their access to the old printers, then guiding users in selecting their new default printers and deleting the old printer names. This type of scenario can be problematic because if users don't follow instructions correctly, they can experience dead printer connections after you decommission the old print servers. The VBScript code that Listing 1 shows prevents these problems when you run it at logon.

To run the script, you need a list of your old and new print queue names in a comma-separated text file. I used C:\printers.txt for the file location, but you can also use a network share. You need to use the following format for the script to work:

\\oldserver\oldprinter,
  \\newserver\newprinter

where oldserver and oldprinter are the names of the old server and printer, respectively, and newserver and newprinter are the names of the new server and printer, respectively. Although this entry appears on two lines here, you would enter it all on one line in the text file, with no space between the comma and the double backslash (\\).

The script enumerates each user's printer connections, parses as an array variable the first line of the text file you created, and uses these results in conditional statements that replace the old printers with the new printers. Then, the script loops to reference the next line in the text file you created and repeats the process until the script reads all the lines in the text file.

Because the script's oPrinters.Count property returns two pieces of information for each printer (i.e., port and Universal Naming Convention—UNC—name), I've added a For...Next statement so that the script will read both pieces of information for each printer before moving to the next printer. Otherwise, the script would take twice as long to run.

Although you can use the WshNetwork.SetDefaultPrinter method to set a default printer, no Windows Script Host (WSH) method is available to determine what the default printer is. Thus, this script is particularly valuable. The HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows registry subkey's Device value corresponds to your default printer; you can use this registry value in your conditional statement as a string variable. A lag time exists between the command to install a printer and the printer's availability to the OS, but the script's sleep delay lets the script run smoothly.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish