Managing TCPIP Ports for Network-Attached Printers

 < Day Day Up > 



Managing TCP/IP Ports for Network-Attached Printers

TCP/IP ports are used to make connections to network-attached printers. You create and manage TCP/IP ports using Prnport. Like Prnmngr, Prnport is a Windows script that must be run using the command-line script host.

Creating and Changing TCP/IP Ports for Printers

You tell Prnport that you want to add a TCP/IP port by using the –A parameter. Then you specify the port name using the –R parameter and specify the printer’s IP address using the –H parameter. It is common to base the port name on the IP address for the printer to which you are connecting. For example, if you are configuring a port for a printer on IP address 192.168.10.15, you might use a port name of IP_192.168.10.15.

You must also specify the output protocol that the port should use. The output protocol is set with the –O parameter and is either raw or lpr. Most printers use the Raw protocol. With Raw, data is sent unmodified over the port to the printer using a designated port number. In most cases, this is port 9100, which is why this is used as the default value. You can set the port number to a different value using the –N parameter. With LPR, the port is used in conjunction with a LPD (line printer daemon) print queue. You set the print queue name using the –Q parameter.

As with most printer configuration commands, you don’t have to be logged on to the computer locally to configure ports. If you want to configure ports on a remote computer, use the –S parameter to specify the name of the remote computer to work with. As necessary, use the –U and –W parameters to specify the user name and password to use when connecting to the remote computer. The user name can be specified as domain\username if the logon domain is different from the current domain.

Consider the following examples:

Configure a port to use TCP Raw and connect to 192.168.10.15 over port 9100:

prnport -a -r IP_192.168.10.15 -h 192.168.10.15 -o raw

Configure a port to use Raw output and connect to 10.10.1.50 over port 9500:

prnport -a -r IP_192.168.10.15 -h 10.10.1.50 -o raw -n 9500 

Configure a port to use LPR output and connect to 172.20.18.2. Set the queue name to LPRQUEUE:

prnport -a -r IP_192.168.10.15 -h 172.20.18.2 -o lpr -q lprqueue

Configure a port on CORPSVR03 to use TCP Raw and connect to 192.168.10.15 over port 9100:

prnport -a -r IP_192.168.10.15 -h 192.168.10.15 -o raw -s corpsvr03

If a port is created successfully, Prnport will report “Created/updated port.” Otherwise, it will report “Unable to create/update port” and describe the error that occurred.

Most network-attached printers also support the Simple Network Management Protocol (SNMP). To allow the printer to use this protocol, you must enable SNMP using the –Me parameter then set an SNMP community name using the –Y parameter and SNMP device index using the –I parameter. Typically, the community name is set to public, which indicates the print device is available for use and management by anyone on the network. The device index is used to designate a particular device in an SNMP community. The first device has an index of 1, the second an index of 2, and so on.

Consider the following example:

prnport –a –r IP_192.168.10.15 –h 192.168.10.15 –o raw –me –y public –i 1

Note

You can specifically disable SNMP using the –Md parameter.

Here you configure a port to use TCP Raw and connect to 192.168.10.15 over Port 9100. You also enable SNMP and configure the SNMP community name as public and the device index as 1.

If you want to change the TCP/IP port configuration later, you can do this using Prnport with the –T parameter. Here, you use the –R parameter to specify the port you want to work with, and any other parameters to set the related property values. Consider the following example:

prnport –a –r MainPrinter –h 10.10.12.50 –o raw –md

Here, you specify that you want to change the MainPrinter TCP/IP port. You set 10.10.12.50 as the IP address, the output protocol as Raw and disable SNMP.

Listing Information About TCP/IP Ports Used by Printers

You can list all the printer TCP/IP ports that are configured on the local computer by typing prnport –l. If you want to view this information for a remote computer, add the –S parameter followed by the computer name, such as: prnport –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 a local computer) as well as other important information about each port that is configured. Here is an example of the information provided for a RAW port:

Server name
Port name IP_192.168.1.101
Host address 192.168.1.101
Protocol RAW
Port number 9100
SNMP Enabled
Community public
Device index 1

Here is an example of the information provided for an LPR port:

Server name
Port name IP_192.168.1.101
Host address 192.168.1.101
Protocol LPR
Queue crownnet
Byte Count Enabled
SNMP Enabled
Community public
Device index 1

Note

The LPR port information may show incorrectly that byte counting is enabled. When enabled, the computer counts the number of bytes in a document before sending it to the printer. Most printers do not require byte counting and it can slow performance because it is very time-consuming to count each byte in documents when printing.

Deleting TCP/IP Ports Used by Printers

You can delete individual ports used by printers with the following syntax:

prnport -d -r PortName 

such as

prnport -d -r IP_192.168.1.101 

If you enter an invalid printer name, Prnport will report that it is unable to delete the port because it wasn’t found. If you do not have permission to delete the printer, Prnport 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

prnport -d -r IP_192.168.1.101 -s corpsvr03 -u wrstanek -p goldfish



 < 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