Add-PrinterPort

Installs a printer port on the specified computer.

Syntax

Add-PrinterPort
   [-Name] <String>
   [-ComputerName <String>]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-PrinterPort
   [-Name] <String>
   [-ComputerName <String>]
   [-SNMP <UInt32>]
   [-SNMPCommunity <String>]
   [-LprHostAddress] <String>
   [-LprQueueName] <String>
   [-LprByteCounting]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-PrinterPort
   [-Name] <String>
   [-ComputerName <String>]
   [-PrinterHostAddress] <String>
   [-PortNumber <UInt32>]
   [-SNMP <UInt32>]
   [-SNMPCommunity <String>]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-PrinterPort
   [-ComputerName <String>]
   [-HostName] <String>
   [-PrinterName] <String>
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Add-PrinterPort cmdlet creates a printer port on the specified computer. You can create a local printer port, a printer port using TCP, and LPR printer ports by using Add-PrinterPort.

You cannot use wildcard characters with Add-PrinterPort. You can use Add-PrinterPort in a Windows PowerShell remoting session.

You do not need administrator credentials to run Add-PrinterPort.

Examples

Example 1: Create a local printer port

Add-PrinterPort -Name "LocalPort:"

This command creates a local printer port named LocalPort on the local computer.

Example 2: Create a TCP printer port

Add-PrinterPort -Name "TCPPort:" -PrinterHostAddress "192.168.100.100"

This command creates a TCP printer port named TCPPort: with an IP address of 192.168.100.100 on the computer.

Parameters

-AsJob

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CimSession

Runs 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.

Type:CimSession[]
Aliases:Session
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ComputerName

Specifies the name of the computer to which to add the printer port. If you do not specify a value, the printer port is added to the local computer.

Type:String
Aliases:CN
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HostName

Specifies the host name of the computer on which to add LPR printer port.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-LprByteCounting

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LprHostAddress

Specifies the LPR host address when installing a TCP/IP printer port in LPR mode.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-LprQueueName

Specifies the LPR queue name when installing a TCP/IP printer port in LPR mode.

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of the printer port to install on the specified computer.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PortNumber

Specifies the TCP/IP port number for the printer port added to the specified computer.

Type:UInt32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PrinterHostAddress

Specifies the host address of the TCP/IP printer port added to the specified computer.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PrinterName

Specifies the name of the printer installed on the LPR printer port.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SNMP

Enables SNMP and specifies the index for TCP/IP printer port management.

Type:UInt32
Aliases:SNMPIndex
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SNMPCommunity

Specifies the SNMP community name for TCP/IP printer port management.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ThrottleLimit

Specifies 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 Windows 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.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

This cmdlet accepts no input objects.

Outputs

CimInstance

This cmdlet returns an object that contains the new printer port.