Managing Printers

 < Day Day Up > 



From the command line, you can install and manage printers using the Prnmngr utility. Prnmngr is configured as a Windows script so if this is your first time working with Windows scripts from the system’s command line or you’ve configured WScript as the primary script host, you will need to set CScript as the default script host. You do this by typing cscript //h:cscript //s at the command prompt. You will then work with the command-line script host rather than the graphical script host. Keep in mind that the script host is set on a per-user basis. Thus, if you are running a script as a specific user, that user might not have CScript configured as the default script host and you might want to type cscript //h:cscript //s as a line in your script.

Understanding Printer Management

With Prnmngr, you can work with print devices that are physically attached to a computer and employed only by the user who logs on to that computer, called local print devices, and print devices that are set up for remote access over the network, called network print devices. The key difference between a local printer and a network printer is that local printers aren’t shared. When you share printers over the network, you use a computer to host the necessary print services. This computer is called a print server.

The primary job of a print server is to share the print device out to the network and to handle print spooling. Using a printer server gives you a central print queue that you can manage easily and makes it so that you don’t have to install printer drivers on client systems. You don’t have to use a print server, however. Users can connect directly to a network-attached printer and in this case, the network-attached printer is handled much like a local printer attached directly to the user’s computer. Here, users connect to the printer and each user has a different print queue that must be managed separately.

When you install a printer on a computer, you are actually configuring a print queue so that it can be used to route print jobs to the physical print device. So when we talk about installing a printer or configuring a printer, we are really talking about installing and configuring a print queue so that it can be used to route jobs to the physical print device.

If you want to install or configure printers, you’ll need the appropriate administrator privileges. In a domain, this means you must be a member of the Administrators, Print Operators, or Server Operators group. To connect to and use a printer, you don’t have to be an administrator. You only need the appropriate access permissions.

Installing Physically Attached Print Devices

Physically attached print devices are connected to a computer directly and can be configured as local print devices or as network print devices. Although a local print device is only available to users logged on to the computer, a network device is accessible to any network users as a shared print device. To get started, connect the print device to the server using the appropriate serial, parallel, or USB cable and then turn on the printer. If you are configuring a network printer, this computer will act as the print server. With Plug-and-Play printers, simply plugging in the printer will start the automatic installation and configuration process if someone is logged on to the computer.

You can install a local printer manually using Prnmngr and the following parameters:

  • A AddPrinter Specifies that you want to add or install a local printer.

  • P PrinterName Assigns a name to the printer. This is the name you’ll see whether working with Printers And Faxes or with the command line.

  • M PrinterModel Specifies the model of the printer. This must be the exact model as specified by the manufacturer. The model name determines the printer driver used.

  • R PrinterPort Sets the port to which the printer is connected. This can be a parallel port, such as LPT1:, LPT2:, or LPT3:, a serial port, such as COM1:, COM2:, or COM3:, or a USB port, such as USB001.

Note

The case you use when setting the printer name and model is the case that is displayed at the command prompt and in dialog boxes. However, although these names are case-aware, they aren’t case-sensitive. This means that, so far as Windows is concerned, centralcolorlaser is the same as CentralColorLaser.

To configure physically attached printers, you don’t have to be logged on to the computer locally. You can also remotely install this type of printer. To do this, use the –S parameter to specify the name of the remote computer to which you want to add a local printer. If necessary, use the –U and –W parameters to specify the user name and password to use when connecting to a remote computer.

Note

You cannot specify a username and password when working at a local command prompt whether physically logged on or remotely connected. If you try to do this, you will get an error. On Windows Server 2003, this error is misleading because it states, “User credentials cannot be used for connections.” Windows XP Professional more correctly states, “User credentials cannot be used for local connections.”

To see how Prnmngr is used, consider the following examples:

Configure an HP 5500 Series InkJet printer on USB001:

prnmngr -a -p "OfficeJetPrinter" -m "hp officejet 5500 series" -r 
USB001

Configure an HP 1100 DN Series InkJet printer on LPT1:

prnmngr -a -p "BusinessJetPrinter" -m "hp businessjet 1100 series 
DN" -r LPT1

Configure an Epson Stylus Photo printer on cdesign09 using USB001:

prnmngr -a -p "PhotoPrinter" -m "epson stylus photo 1270 esc/p 2" 
-r USB001 -s cdesign09

Configure an Epson Stylus Color printer on mteam06 using LPT1:

prnmngr -a -p "ColorPrinter" -m "epson stylus color esc/p 2" -r LPT1: 
-s mteam06 -u wrstanek -w goldfish

If a printer is installed successfully, Prnmngr will report “Added printer”. Otherwise, it will report “Unable to add printer” and describe the error that occurred. The most common error is due to a misentered or unknown device model, which causes Prnmngr to report that the printer driver is unknown. Ensure that you are using the correct model name.

Note

If this is the first printer installed on a computer, it will be set at the default printer. The printer will not be shared, however. If you want to share the printer so that others can use it, see the section of this chapter titled “Sharing Printers.”

Tip

You can create additional printers for the same print device. The only requirements are that the printer name and the share name be unique. Having additional printers for the same print device allows you to set different properties to serve different needs. You can, for example, have one configuration for low priority print jobs and another for high-priority print jobs.

Installing Network-Attached Print Devices

Network-attached print devices are attached directly to the network through a network adapter card and are typically configured as network print devices so that they are accessible to network users as shared print devices. To get started, connect the printer to the network and configure it to use an appropriate IP address or obtain an IP address from a DHCP server. Follow the steps as discussed in the printer manual from the manufacturer.

After you configure TCP/IP on the printer, you will need to create a TCP/IP port on the computer which will act as the print server for the printer. The port is used to make a connection over the network to the printer. You can then install the printer as you would a physically attached print device. The only difference is that you use –R to specify the TCP/IP port you created rather than an LPT, COM or USB port. For example, if you created a TCP/IP port called IP_192.168.10.15, you can add a printer that uses the port using the following command line

prnmngr -a -p "CentralColorLaser" -m "magicolor 2300 dl" -r 
IP_192.168.10.15 -s corpsvr03

Here, you install a Minolta QMS magicolor color laser printer so that it uses a TCP/IP port. Because the printer is configured on CorpSvr03, that computer will act as the printer server for this device. The printer will not be set as the default printer for any users, nor will it be shared. If you want to share the printer so that others can use it, see the section of this chapter titled “Sharing Printers.”

Listing Printers Configured on a Computer

You can list all the printers that are configured on the local computer by typing prnmngr –l. If you want to view this information for a remote computer, add the –S parameter followed by the computer name, such as: prnmngr –l –s corpsvr03. As necessary, you can use the –U and –W parameters to set the user name and password of the logon account to use as well.

The output shows the name of the print server (or blank if you are working on a local computer) as well as other important information about each printer that is configured. Here is an example:

Server name corpsvr03
Printer name magicolor 2300 DL
Share name magicolo
Driver name magicolor 2300 DL
Port name hpbusinessinkjet1100
Comment Main printer for the fifth floor.
Location 5/ne
Print processor MIMFPR_B
Data type IMF
Parameters
Attributes 2633
Priority 1
Default priority 0
Status Idle
Average pages per minute 0

Number of printers enumerated 1

The printer, driver, and port names were set when the printer was installed. The printer is shared as well, making it available to users in the domain for printing. If you wanted to move the printer to a new print server, the only information you really need to note is the driver name, which in most cases is the same as the printer’s model.

Viewing and Setting the Default Printer

You can display the default printer for the current logged on user by typing prnmngr –g at the command prompt. If you want the user to have a different default printer, you can type prnmngr –t –p followed by the name of the printer that should be the default, such as

prnmngr -t -p "magicolor 2300 DL"

If successful, Prnmngr will report that the printer is now set as the default. Otherwise, Prnmngr will report an error. Typically, a “Not Found” error means that you entered an invalid printer name.

Renaming Printers

Renaming printers is one printer task that you can’t perform with Prnmngr. The command utility that you use for this task is Prncnfg, which is available in the Windows Server 2003 Resource Kit. The syntax for renaming printers is

prncnfg -x -p CurrentPrinterName -z NewPrinterName 

Here, you use Prncnfg with the –X parameter to indicate that you want to rename a printer. Then specify the current printer name with the –P parameter and set the new printer name with the –Z parameter, such as

prncnfg -x -p "CentralColorLaser" -z "EngineeringPrinter"

If the printer exists, Prncnfg will report that it has renamed the printer and set the new printer name.

You can also rename printers that are on remote computers. To do this, use the –S parameter to specify the name of the remote computer, such as

prncnfg -x -s corpsvr03 -p "CentralColorLaser" -z "EngineeringPrinter"

Here, you are renaming a printer on CorpSvr03. This command doesn’t let you set the account for logon, however.

Deleting Printers

Prnmngr provides two ways to delete printers that you no longer want to be available on a particular computer. You can delete individual printers using the command

prnmngr -d -p PrinterName 

such as

prnmngr -d -p "magicolor 2300 DL"

If you enter an invalid printer name, Prnmngr will report that it is unable to delete the printer because the printer wasn’t found. If you do not have permission to delete the printer, Prnmngr will report that it is unable to enumerate printers due to the user credentials. You’ll need to log on with an account that has the appropriate administrator privileges. Note that this isn’t the case when you work with remote computers. When you work with remote computers, you can specify the logon account using the –U and –W parameters, such as

prnmngr -d -p "magicolor 2300 DL" -s corpsvr03 -u wrstanek -p goldfish

You can delete all printers from a computer using

prnmngr -x

Prnmngr won’t prompt you to confirm this action, but it will tell you about each printer deleted, such as

Deleted printer OfficeJet
Deleted printer CentralPrinter

Number of local printers and connections enumerated 2
Number of local printers and connections deleted 2



 < Day Day Up > 



Microsoft Windows Command-Line Administrator's Pocket Consultant
MicrosoftВ® WindowsВ® Command-Line Administrators Pocket Consultant
ISBN: 0735620385
EAN: 2147483647
Year: 2004
Pages: 114

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net