Add-PrinterPort
Add-PrinterPort [-Name*] <String> [-CimSession <CimSession[]>] [-ComputerName <String>] [-ThrottleLimit <Int32>][-Confirm] [-WhatIf] [<CommonParameters>]
Add-PrinterPort [-Name*] <String> [-PrinterHostAddress*] <String> [-CimSession <CimSession[]>] [-ComputerName<String>] [-PortNumber <UInt32>] [-SNMP <UInt32>] [-SNMPCommunity <String>] [-ThrottleLimit <Int32>] [-Confirm][-WhatIf] [<CommonParameters>]
Add-PrinterPort [-HostName*] <String> [-PrinterName*] <String> [-CimSession <CimSession[]>] [-ComputerName <String>][-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Add-PrinterPort [-Name*] <String> [-LprHostAddress*] <String> [-LprQueueName*] <String> [-CimSession <CimSession[]>][-ComputerName <String>] [-LprByteCounting] [-SNMP <UInt32>] [-SNMPCommunity <String>] [-ThrottleLimit <Int32>][-Confirm] [-WhatIf] [<CommonParameters>]
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.
Parameters
-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.
-ComputerName [<String>]
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.
-HostName <String>
- This value is required
Specifies the host name of the computer on which to add LPR printer port.
-LprByteCounting [<SwitchParameter>]
Indicates that this cmdlet enables LPR byte counting for a TCP/IP printer port in LPR mode.
-LprHostAddress <String>
- This value is required
Specifies the LPR host address when installing a TCP/IP printer port in LPR mode.
-LprQueueName <String>
- This value is required
Specifies the LPR queue name when installing a TCP/IP printer port in LPR mode.
-Name <String>
- This value is required
Specifies the name of the printer port to install on the specified computer.
-PortNumber [<UInt32>]
Specifies the TCP/IP port number for the printer port added to the specified computer.
-PrinterHostAddress <String>
- This value is required
Specifies the host address of the TCP/IP printer port added to the specified computer.
-PrinterName <String>
- This value is required
Specifies the name of the printer installed on the LPR printer port.
-SNMP [<UInt32>]
Enables SNMP and specifies the index for TCP/IP printer port management.
-SNMPCommunity [<String>]
Specifies the SNMP community name for TCP/IP printer port management.
-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 PowerShellr 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.
-Confirm [<SwitchParameter>]
- Default value is false
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
-WhatIf [<SwitchParameter>]
- Default value is false
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.
Inputs
NoneOutputs
Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterPortExamples
- Create a local printer port:
PS C:\> Add-PrinterPort -Name "LocalPort:"
This command creates a local printer port named LocalPort on the local computer.
- Create a TCP printer port:
PS C:\> 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.
This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.
PowerShell Commands