Whether you use client-mapped printers or server printers, you'll need to have printer drivers installed on each of your Terminal Servers. Consequently, you will need to spend some time thinking about how to manage those printer drivers. Before we address this issue, however, let's look at what printer drivers really are, how they work, and how they're stored on Windows servers.
How Windows Printer Drivers Work
Fundamentally, Windows printer drivers translate print jobs from an enhanced metafile format, which is printer-independent, into the native language that can be understood by a printer. This is why a printer prints garbage when you use the wrong driver. Printer drivers need to be installed and registered on a computer before they can be used.
Two things happen when you install a printer driver onto a Terminal Server or Windows 2000 server. First, the necessary printer driver files are copied from the source location to the server. The server stores printer driver files in the %systemroot%\system32\spool\drivers\w32x86\3\ folder. In this path, the "w32x86" signifies an Intel Windows 32-bit platform, and the "3" signifies the version of the printer driver (3 = Windows 2000/XP/2003).
Second, the driver's details are written to the registry in this path: HKLM\System\CurrentControlSet\Control\Print\Environments\ Windows NT x8 6\Drivers\Version-3\<printerdrivername>. Similar to the file path, a Version-3 key means that the driver is a Windows 2000/XP/2003 driver.
User's individual printer settings, such as print, duplexing, and paper tray options, are stored in the HKCU\Printers registry key. These settings are user-specific and stored in their profile, just like any other customized Windows settings.
Installing Printer Drivers
Installing print drivers onto a Terminal Server is no different than installing printer drivers onto any Windows computer.
The easiest way to install a driver without actually installing a printer is via the "Printers and Faxes" applet. (Start | Printers and Faxes | File Menu | Server Properties | "Drivers" tab | "Add" button) On a Terminal Server, it's only necessary to add the Windows 2000/XP/2003 version of the driver, since you're only installing the driver so you can print from server sessions.
If you have a lot of drivers to install, you can script the process using rundll32.exe to call the printui.dll (the Printer Properties User Interface).
If you're only using printers whose drivers are built-in to Windows 2003 (via the "driver.cab" file discussed previously) then you don't really have to worry about driver installation since the process is automatic when the printer is installed. However, if you have a number of drivers that are not part of the Windows 2003 install, you can script the following command to install a large number of printer drivers at once:
rundll32 printui.dll,PrintUIEntry /ia /m "Driver Name" /h "Intel" /v "Version of driver" /f \\Source\print.inf
To use this command, replace Driver Name with the driver's name as it appears in the .INF file, replace Version of Driver with the platform for which it was written, (generally Windows 2000 or XP) and replace the \\Source\print.inf with the path and .INF filename for the printer driver. For more information on using rundll32.exe for installing and removing printers and drivers, run "rundll32 prinui.dll, PrintUIEntry /?" from a command prompt. When using this command, note that there is a comma with is no space between the word prinui.dll and PrintUIEntry.
Removing Printer Drivers
When you delete a printer from the "Printers" folder on one of your Terminal Servers, the drivers are not uninstalled from the server. This can be a problem if you've identified that a certain printer driver causes problems, since you need to be able to remove that driver from the server to prevent clients from using it.
Fortunately, the Printers and Faxes applet in Windows 2003 (and 2000) can also be used to remove drivers from your Terminal Server. (Start | Printers and Faxes | File Menu | Server Properties | "Drivers" tab | "Remove" button) Of course this will only remove the driver if no printers are currently using it.
Alternately, you can also use the "rundll32" command we used previously to remove the print driver. All that is required is the modification of a couple of switches. The cool thing about using the rundll32 method is that it can even be done from remote machines. Here are some examples of how to use the command line to remove a local driver and a driver from a remote server.
To remove a driver from a machine you are logged into:
rundll32 printui.dll,PrintUIEntry /dd /m "HP DeskJet 500" /h
"Intel" /v "Windows 2000"
To remove a driver from a remote machine:
rundll32 printui.dll,PrintUIEntry /dd /c\\Computername /m
"HP DeskJet 500" /h "Intel" /v "Windows 2000"
Make sure to replace Computername with the name of the server you are removing the driver from.
If all else fails (which unfortunately still happens, even with Windows 2003), you can manually remove a printer driver and all traces of its existence by following this procedure:
If you haven't done so already, remove the printer by deleting it form the "Printers" folder.
Stop the spooler service.
Browse to the following registry location: HKLM\System\ Current-ControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-x\<printerdrivername>, where x is the version of the driver (2 = NT 4.0, 3 = Windows 2000/2003).
Note the names of the files listed.
Remove the registry key yourprinterdriver.
Delete the referenced driver files from the %systemroot%\ system32\ spool\drivers\w32x86\x folder. If you have multiple printers installed, you may want to copy the driver files to a temporary location before you delete them outright, because many similar types of printers use the same driver files.
If you're not able to delete the files, you will need to disable the spooler, reboot, and delete the files again. After you do this, reset the spooler to "automatic" startup.
After the print drivers have been removed, you should reboot the server.
What driver does a Printer Use?
Occasionally you will need to figure out which drivers a printer uses that you haven't installed yet. This is especially handy if you allow your Terminal Server to automatically install any needed printer drivers.
Every Windows 2000 and Windows 2003 server has a "master list" of default printers that it supports and the drivers that each printer needs. That master list is stored in the %systemroot%\inf\ntprint.inf file. You can open this file in a text editor to see which drivers each printer will request. Ntprint.inf is organized by manufacturer, with individual printers and their drivers listed under the manufacturer's section, as shown below.
"HP 2000C" = HPV2000C.GPD.ICM
Printer and Driver Replication
One of the printing-related challenges that you'll face as an administrator of a multiple server environment is that each Terminal Server maintains its own list of configured printers and locally installed print drivers. Each Terminal Server is completely unaware of the printer configuration and installed drivers of the other Terminal Servers.
Further complicating this is that as an administrator, you'll have no idea whether a printer driver has been updated or installed unless you view each server and driver individually.
In addition to this, server printers and their configurations are stored locally on each server and must be added, removed, or modified on every server to maintain a consistent environment. This leads to a management nightmare in environments with hundreds different client printers.
In a load-balanced or clustered server environment, each server must be configured identically. This means that drivers, printers, and printer configurations should match on all servers in the cluster. Doing this manually in a server cluster of 5 servers with 100 printers would be extremely time consuming. Now imagine those same printers in a 20-or 30-server cluster, and you'll quickly realize that you need a better way to manage drivers.
There are really only a couple of ways to get both the Windows print drivers and the server printers you have created on a Terminal Server to other servers:
Replication using Print Migrator.
Use a third-party printer management tool (discussed later in this chapter).
Method 1. Using Print Migrator to Replicate Drivers
Print Migrator is a tool from Microsoft that can be used to replicate printer drivers between servers. (Since Microsoft is always changing things on their website, the easiest way to find this tool is to do a search on Microsoft.com for "Print Migrator." The version discussed here is 3.1.)
Printer Migrator allows you to back up printers, print queues, ports, printer drivers, and printer shares to a .cab file. You can then restore the settings of that .cab file to another server. You can even use this tool to migrate printers between different versions of Terminal Server.
Advantages of Print Migrator Replication
Drivers and settings can be replicated to remote servers.
Drivers can be replicated from network print servers to Terminal servers.
Print Migrator can be command-line driven, allowing you to script and schedule it with the command scheduler. (Run printmig /? for a list of command-line options.)
This too is really easy to use.
Disadvantages of Print Migrator Replication
Migration must be manually invoked.
The spooler service is stopped while this tool is used.
Since this tool packages drivers into the CAB file, the CAB file can become quite large.
Target Terminal Servers must be placed into "install" mode.
Method 2. Manual Print Driver Replication
The other option for replicating printer drivers is to do it manually. You must manually install or copy all of the needed printer drivers onto each of your Terminal servers.
Advantages of Manual Print Driver Replication
No learning curve.
Allows you to install different printer drivers to different servers.
Works well in small environments with only a few drivers.
Disadvantages of Manual Print Driver Replication
Drivers must be manually installed onto each Terminal server.