Add-PrinterPort

Add-PrinterPort

Installs a printer port on the specified computer.

Syntax

Parameter Set: local
Add-PrinterPort [-Name] <String> [-AsJob] [-CimSession <CimSession> ] [-ComputerName <String> ] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

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

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

Parameter Set: tcplpr
Add-PrinterPort [-Name] <String> [-LprHostAddress] <String> [-LprQueueName] <String> [-AsJob] [-CimSession <CimSession> ] [-ComputerName <String> ] [-LprByteCounting] [-SNMP <UInt32> ] [-SNMPCommunity <String> ] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Add-PrinterPort cmdlet creates a new 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 cmdlet.

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

You do not need administrator privileges to use Add-PrinterPort.

Parameters

-AsJob

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String>

Specifies the name of the computer to which to add the printer port. If not specified, the printer port is added to the local computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-HostName<String>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LprByteCounting

Enables LPR byte counting for a TCP/IP printer port in LPR mode.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LprHostAddress<String>

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

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LprQueueName<String>

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

Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PortNumber<UInt32>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PrinterHostAddress<String>

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

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PrinterName<String>

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

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SNMP<UInt32>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SNMPCommunity<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ThrottleLimit<Int32>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

    This cmdlet accepts no input objects.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterPort

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

Examples

-------------------------- EXAMPLExample 1: Creates a local printer port -------------------------- xample: Create a local printer port

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

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

-------------------------- EXAMPLExample 2: Creates a TCP printer port -------------------------- xample: Create a TCP printer port

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

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

Get-PrinterPort

Remove-PrinterPort