Add-PrinterPort

Install a printer port on the computer.

Syntax
Local(default):
      Add-PrinterPort [-Name] String [-ComputerName String] 
         [-CimSession CimSession[]] [-ThrottleLimit Int32] [-AsJob] 
            [-WhatIf] [-Confirm] [CommonParameters]

tcp:
      Add-PrinterPort [-Name] String [-ComputerName String]
         [-PortNumber UInt32] [-PrinterHostAddress] String
            [-CimSession CimSession[]] [-ThrottleLimit Int32]
               [-SNMP UInt32] [-SNMPCommunity String] [-AsJob] 
                  [-WhatIf] [-Confirm] [CommonParameters]

tcp lpr:
      Add-PrinterPort [-Name] String [-ComputerName String]
         [-LprHostAddress] String [-LprQueueName] String [-LprByteCounting]
            [-CimSession CimSession[]] [-ThrottleLimit Int32]
               [-SNMP UInt32] [-SNMPCommunity String] [-AsJob] 
                  [-WhatIf] [-Confirm] [CommonParameters]

lpr:
      Add-PrinterPort [-HostName] String  [-PrinterName] String [-ComputerName String] 
         [-CimSession CimSession[]] [-ThrottleLimit Int32] [-AsJob] 
            [-WhatIf] [-Confirm] [CommonParameters]


Key
   -Name 
       The name of the printer port to install.

   -AsJob
       Run the cmdlet as a background job.
       Use this parameter to run commands that take a long time to complete.

   -ComputerName
       The name of the computer computer on which to install the printer port.

   -CimSession
       Run the cmdlet in a remote session or on a remote computer. Enter a computer name or
       a session object, such as the output of a New-CimSession or Get-CimSession cmdlet.
       The default is the current session on the local computer.

   -Confirm
       Prompt for confirmation before executing the command.

   -HostName
       The host name of the computer on which to add LPR printer port.

   -LprByteCounting
       Indicates that this cmdlet enables LPR byte counting for a TCP/IP printer port in LPR mode.

   -LprHostAddress
       The LPR host address when installing a TCP/IP printer port in LPR mode.

   -LprQueueName
       The LPR queue name when installing a TCP/IP printer port in LPR mode.

   -PortNumber
       The TCP/IP port number for the printer port added to the specified computer.

   -PrinterHostAddress
       The host address of the TCP/IP printer port added to the specified computer.

   -PrinterName
       The name of the printer installed on the LPR printer port.

   -SNMP
       Enable SNMP and specify the index for TCP/IP printer port management.

   -SNMPCommunity
       The SNMP community name for TCP/IP printer port management.

   -ThrottleLimit
       The maximum number of concurrent operations that can be established to run the cmdlet.
       If this parameter is omitted or a value of 0 is entered, then PowerShell calculates an
       optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running
       on the computer.
       The throttle limit applies only to the current cmdlet, not to the session or to the computer.

   -WhatIf
       Shows what would happen if the cmdlet runs. The cmdlet is not run.

The Add-PrinterPort cmdlet creates a printer port on the specified computer.

LPR printing sends a job direct to the network printer, line by line, without any complex formatting instructions. The fonts, sizes and layout are therefore largely driven by the printer. This is most often used with monospaced fonts for printing standard documents like cheques, invoices and forms with a standard fixed layout. Being a very simple protocol it can also be very fast.

Examples

Create a local printer port:

PS C:\> Add-PrinterPort -Name "LocalPort:"

Create a TCP printer port:

PS C:\> Add-PrinterPort -Name "TCPPort:" -PrinterHostAddress "192.168.100.100"

PS C:\> Add-PrinterPort -Name "" -PrinterHostAddress "192.168.100.101"

“A pure heart translates into a pure and unselfish motive for undertaking a task” ~ Kazuo Inamori (founder of Kyocera)

Related PowerShell Cmdlets

Add-PrinterDriver - Install a printer driver on the computer.
Add-Printer - Add a printer to the specified computer.
Get-Printer - Retrieve a list of printers installed on a computer.
Get-PrinterPort - Retrieve a list of printer ports.
Get-PrintJob - Retrieve a list of print jobs from the specified printer.
DISM /online /export-driver - Export a list of Drivers.


 
Copyright © 1999-2026 SS64.com
Some rights reserved