Create, delete, or list TCP/IP printer ports, change port configuration.
Syntax cscript PRNPORT.vbs [-options] [-r port] [-s server] [-u user_name] [-w password] [-o raw|lpr ] [-h host address] [-q queue] [-n number] [-me | -md] [-i SNMP index] [-y community] [-2e | -2d] Options -a Add a port -d Delete the specified port -g Get configuration for a TCP port -h IP address of the device -i SNMP index, if SNMP is enabled -l List all TCP ports -m SNMP type. [e] enable, [d] disable -n Port number, applies to TCP RAW ports -o Port type, raw or lpr -q Queue name, applies to TCP LPR ports only -r Port name -s Server Name -t Set configuration for a TCP port -u User Name -w password -y Community name, if SNMP is enabled -2 Double spool, applies to tcp LPR ports. [e] enable, [d] disable -? Display help
PrnPort.vbs is not on the Windows PATH but will be found at:
%Windir%\System32\Printing_Admin_Scripts\locale\prnmngr.vbs
Set _scripts=cscript %Windir%\System32\Printing_Admin_Scripts\en-US
Display all standard TCP/IP printing ports on the server \\prnserv64:
%_scripts%\Prnport.vbs -l -s prnserv64
Delete the standard TCP/IP printing port on the server \\Server64 that connects to a network printer at 10.2.3.4:
%_scripts%\Prnport.vbs -d -s Server64 -r IP_10.2.3.4
Add a standard TCP/IP printing port on the server \\Server64 that connects to a network printer at 10.2.3.4 and uses the TCP raw protocol on port 9100:
%_scripts%\Prnport.vbs -a -s Server64 -r IP_10.2.3.4 -h 10.2.3.4 -o raw -n 9100
Enable SNMP, specify the "public" community name and set the SNMP index to 1 on a network printer at 10.2.3.4 shared by the server \\Server64:
%_scripts%\Prnport.vbs -t -s Server64 -r IP_10.2.3.4 -me -y public -i 1 -n 9100
Add a standard TCP/IP printing port on the local computer that connects to a network printer at 10.2.3.4 and automatically get the device settings from the printer:
%_scripts%\Prnport.vbs -a -r IP_10.2.3.4 -h 10.2.3.4
“ If the highest aim of a captain were to preserve his ship, he would keep it in port forever” ~ Thomas Aquinas
NET VIEW \\Printserver - to view a list of available printers.
NET PRINT - View and Delete print jobs.
PRNCNFG - Configure a printer.
PRNDRVR - Add, delete or list printer drivers.
PRNJOBS - Pause, resume, cancel, or list print jobs.
PRNMNGR - Add, delete or list printer drivers.
PRNQCTL - Manage printer queues, print a test page.
PRINT - Print a text file.
RUNDLL32 - Install/Remove Printers (plus advanced options).
WMIC PRINTER - Set printing options through WMI.
Q246868 - TCP/IP Printing options in the Windows Standard Port Monitor.
Add printer - .AddPrinterConnection
Add Network printer - .AddWindowsPrinterConnection
List printers - .EnumPrinterConnections
Set default printer - .SetDefaultPrinter
Equivalent bash command (Linux): lpc - Line printer control program.