Prnport.vbs

Creates, deletes, and lists standard TCP/IP printer ports, in addition to displaying and changing port configuration. Used without parameters, prnport.vbs displays help for the prnport.vbs command.

To create a standard TCP/IP printer port

Syntax

cscript prnport.vbs -a -r PortName [-s RemoteComputer] -h IPAddress [-u UserName -w Password] [-o {raw -n PortNumber | lpr}] [-q QueueName] [-m{e | d}] [-i IndexName] [-y CommunityName] [-2{e | d}]

Parameters

-a   : Required. Specifies that you want to create a standard TCP/IP printer port.

-r   PortName   : Required. Specifies the port to which the printer is connected.

-s   RemoteComputer   : Specifies, by name, the remote computer to which you want to add the port. If you do not specify a computer, the port is added to the local computer.

-h   IPAddress   : Required. Specifies the IP address you want to assign to the port.

-u   UserName   -w   Password   : Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer on which you want to create a standard TCP/IP printer port. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information about WMI, see Related Topics.

-o { raw   -n   PortNumber | lpr } : Specifies which protocol the port uses: TCP raw or TCP LPR. If you use TCP raw, specifies the port number for a TCP raw printer port. By default, this is port number 9100. For more information, see Related Topics. Most printers use TCP raw. On UNIX networks, printers often use TCP LPR. For more information about TCP raw, see Related Topics. For more information about TCP LPR, see RFC 1179 on the RFC Editor Web site.

-q   QueueName   : Specifies the queue name for a TCP raw port.

-m { e | d } : Specifies whether SNMP is enabled. The parameter e enables SNMP. The parameter d disables SNMP.

-i   IndexName   : Specifies the SNMP index, if SNMP is enabled. For more information, see RFC 1759 at the RFC Editor Web site.

-y   CommunityName   : Specifies the SNMP community name, if SNMP is enabled. For more information, see Related Topics.

-2 { e | d } : Specifies whether double spools (also known as respooling) are enabled for TCP LPR ports. Double spools are necessary because TCP LPR must include an accurate byte count in the control file that is sent to the printer, but the protocol cannot get the count from the local print provider. Therefore, when a file is spooled to a TCP LPR print queue, it is also spooled as a temporary file in the system32 directory. TCP LPR determines the size of the temporary file and sends the size to the server running LPD. The parameter e enables double spools. The parameter d disables double spools.

/? : Displays help at the command prompt.

Remarks

  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.

  • If you want to change the configuration for a standard TCP/IP printer port after you create it, you can use the cscript prnport.vbs command with the -t parameter.

  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

  • Web addresses can change, so you might be unable to connect to the Web site or sites mentioned here. 

To delete a standard TCP/IP printer port

Syntax

cscript prnport.vbs -d -r PortName [-s RemoteComputer] [-u UserName -w Password]

Parameters

-d   : Required. Specifies that you want to delete a standard TCP/IP printer port.

-r   PortName   : Required. Specifies the standard TCP/IP printer port that you want to delete.

-s   RemoteComputer   : Specifies, by name, the remote computer from which to delete the port. If you do not specify a computer, the port is deleted from the local computer.

-u   UserName   -w   Password   : Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer on which you want to delete a standard TCP/IP printer port. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information about WMI, see Related Topics.

/? : Displays help at the command prompt.

Remarks

  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.

  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Example

To delete the standard TCP/IP printer port named IP_192.168.12.128 from the remote computer named HRServer, type:

cscript prnport.vbs -d -r IP_192.168.12.128 -s HRServer

To list all of the standard TCP/IP printer ports on a computer

Syntax

cscript prnport.vbs -l [-s RemoteComputer] [-u UserName -w Password]

Parameters

-l   : Required. Specifies that you want to list all standard TCP/IP printer ports on a computer.

-s   RemoteComputer   : Specifies, by name, the remote computer for which you want to list ports. If you do not specify a computer, the ports on the local computer are listed.

-u   UserName   -w   Password   : Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer for which you want to list all standard TCP/IP printer ports. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information about WMI, see Related Topics.

/? : Displays help at the command prompt.

Remarks

  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.

  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Example

To list all standard TCP/IP printer ports on the remote computer named HRServer, type:

cscript prnport.vbs -l -s HRServer

To display the configuration of a standard TCP/IP printer port

Syntax

cscript prnport.vbs -g -r PortName [-s RemoteComputer] [-u UserName -w Password]

Parameters

-g   : Required. Specifies that you want to display the configuration of a standard TCP/IP printer port.

-r   PortName   : Required. Specifies the port whose configuration you want to display.

-s   RemoteComputer   : Specifies, by name, the remote computer that hosts the port whose configuration you want to display. If you do not specify a computer, information is displayed for the port as it is configured on the local computer.

-u   UserName   -w   Password   : Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer that hosts the port whose configuration you want to display. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information about WMI, see Related Topics.

/? : Displays help at the command prompt.

Remarks

  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.

  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

To configure a standard TCP/IP printer port

Syntax

cscript prnport.vbs -t -r PortName [-s RemoteComputer] [-o {raw -n PortNumber | lpr}] [-h IPAddress] [-q QueueName] [-m{e | d}] [-i IndexName] [-y CommunityName] [-2{e | d}] [-u UserName -w Password]

Parameters

-t   : Required. Specifies that you want to configure a standard TCP/IP printer port.

-r   PortName   : Required. Specifies the port to which the printer is connected.

-s   RemoteComputer   : Specifies, by name, the remote computer on which you want to configure the port. If you do not specify a computer, the port is configured on the local computer.

-o { raw   -n   PortNumber | lpr } : Specifies which protocol the port uses: TCP raw or TCP LPR. If you use TCP raw, specifies the port number for a TCP raw printer port. By default, this is port number 9100. For more information, see Related Topics. Most printers use TCP raw. On UNIX networks, printer ports often use TCP LPR. For more information about TCP raw, see Related Topics. For more information about TCP LPR, see RFC 1179 at the RFC Editor Web site.

-h   IPAddress   : Specifies, by IP address, the printer for which you want to configure the port.

-q   QueueName   : Specifies the queue name for a TCP raw port.

-m { e | d } : Specifies whether SNMP is enabled. The parameter e enables SNMP. The parameter d disables SNMP.

-i   IndexName   : Specifies the SNMP index, if SNMP is enabled. For more information, see RFC 1759 at the RFC Editor Web site.

-y   CommunityName   : Specifies the SNMP community name, if SNMP is enabled. For more information, see Related Topics.

-2 { e | d } : Specifies whether double spools (also known as respooling) are enabled for TCP LPR ports. Double spools are necessary because TCP LPR must include an accurate byte count in the control file that is sent to the printer, but the protocol cannot get the count from the local print provider. Therefore, when a file is spooled to a TCP LPR print queue, it is also spooled as a temporary file in the system32 directory. TCP LPR determines the size of the temporary file and sends the size to the server running LPD. The parameter e enables double spools. The parameter d disables double spools.

-u   UserName   -w   Password   : Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer on which you want to configure a port. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information about WMI, see Related Topics.

/? : Displays help at the command prompt.

Remarks

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

Prncnfg.vbs

Prnjobs.vbs

Prnmngr.vbs

Prndrvr.vbs

Prnqctl.vbs

Command-line reference A-Z

Using the command-based script host (CScript.exe)

Defining communities

WMI overview

WMI overview