Prnport command in Windows

(Applies to Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012)

(Applies to Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012)

The prnport command in addition to displaying and changing the port configuration also helps create, delete and list standard TCP / IP printer ports,

Prnport command syntax

 cscript prnport {-a | -d | -l | -g | -t | -?} [-r] 
lpr}]
d}
-d}

Prnport command parameter

Parameters

Describe

-a

Create a standard TCP / IP printer port.

-d

Delete a standard TCP / IP printer port.

-l

List all standard TCP IP printer ports on the computer specified by the -s parameter.

-g

Displays the configuration of the standard TCP / IP printer port.

-t

Configure settings for standard TCP / IP printer ports.

-r

Specify the port to which the printer is connected.

-S

Specify the name of the remote computer that the printer store you want to manage.If you do not specify a remote computer, the local computer will be used by default.

-u -w

Specify the authorized account to connect to the printer storage computer you want to manage.All members in the local administrator group of the target computer have these rights, but the permissions can also be granted to other users.If you do not specify an account, you must log in to an account with these permissions so that the command can be executed.

lpr}

Specify the protocol to which the port will use, TCP raw or TCP lpr.If you use raw TCP, you can optionally specify the port number by using the -n parameter.The default port number is 9100.

-hour

Specify (by IP address) the printer you want to configure the port for.

-q

Specifies the queue name for a raw TCP port.

-n

Specify the port number for the raw TCP port.The default port number is 9100.

d}

Specify whether SNMP is enabled.Parameter e activates SNMP.The parameter d turns off SNMP.

-i

Specify the SNMP index, if SNMP is enabled.For more information, see Rfc 1759 at the Rfc editor website.

-y

Specify the community name of SNMP, if SNMP is enabled.

-d}

Specify whether the double spool (double spools, also called respooling) is enabled for TCP lpr port.Dual spool is necessary because TCP lpr must include the exact number of bytes in the control file sent to the printer, but the protocol cannot receive the count from the local print provider.So when a file is spooled into a TCP lpr queue, it is also spooled as a temporary file in the system32 directory.TCP lpr determines the size of the temporary file and sends this size to the server running LPD.The parameter e activates the double spool while parameter d disables the double spool.

/?

Show help at thecommand prompt.

Prnport command comment

The prnport command is a Visual Basic script located in the % WINdir% System32printing_Admin_Scripts directory . To use this command, at the command prompt, type cscript followed by the full path to the prnport file, or change the directory to the appropriate directory.For example:

 cscript% WINdir% System32printing_Admin_Scriptsen-USprnport 

If the information you provide contains spaces, use quotation marks for the text (for example, "computer Name").

Example prnport command

To display all standard TCP / IP print ports on the server named Server1, enter:

 cscript prnport -l -s Server1 

To delete the standard TCP / IP print port on the server named Server1 connected to the printer network in 10.2.3.4, enter:

 cscript prnport -d -s Server1 -r IP_10.2.3.4 

To add a standard TCP / IP print port on a server named Server1 connected to the printer network in 10.2.3.4 and use the raw TCP protocol on port 9100, enter:

 cscript prnport -a -s Server1 -r IP_10.2.3.4 -h 10.2.3.4 -o raw -n 9100 

To enable SNMP, specify the "public" community name and set the SNMP index to 1 on the printer network in 10.2.3.4 shared by the Server1 server:

 cscript prnport -t -s Server1 -r IP_10.2.3.4 -me -y public -i 1 -n 9100 

To add a standard TCP / IP print port on the local computer connected to the printer network in 10.2.3.4 and automatically receive device settings from the printer, enter:

 cscript prnport -a -r IP_10.2.3.4 -h 10.2.3.4 

See more:

  1. The print command in Windows
  2. The net print command in Windows
  3. Netcfg command in Windows
  4. Nbtstat command in Windows
3.9 ★ | 29 Vote