Open navigation

New-TpmsObjTcpIpPortLpr

Description

Syntax

Example 1: cmdlet usage

Example 2: Script containing New-TpmsObjTcpIpPortLpr



Description

Defines a model for an LPR Port using the Standard TCP/IP Port monitor. The model is represented by a container that predefines all printer ports to be installed by Tpms.Agent in one variable.

Afterwards, this model can be used to define the target machine using New-TpmsObjApplyAgent and to perform the installation process using Start-TpmsApplyByAgent.

path of print data with classic LPR/LPD printing


Syntax

New-TpmsObjTcpIpPortLpr -Name <String> -HostAddress <String> -Queue <string> [-EnableByteCounting <boolean>] [-Filter <char>]
ParameterDescription
-Name

printer port name to be created; the port name must end with a colon ( : ), examples:

LprPort: or "Lpr Port:"

-HostAddresssets the printer’s or LPDs target address; see Printer Name or IP Address
-EnableByteCounting

enables LPR Byte Counting

1: enabled

0: disabled (default)

-Queuename of the LPD queue on a Linux or Unix target machine; see Queue Name
-Filteroption: name of the decompression filter installed on the Linux or Unix target machine; only one character is to be given

LPR Port settings

LPR Port settings


Example 1: cmdlet usage

$port = New-TpmsObjTcpIpPortLpr -Queue lp1 -HostAddress 92.168.210.61 -EnableByteCounting 1 -Name TpmsTestPort:

Defines a Standard TCP/IP Port with the denomination TpmsTestPort:, set up to LPR with the IP address 192.168.210.61 and the TCP port 515, and writes this setting to the variable $port.

See also New-TpmsObjApplyAgent for advice on using the $port variable.


Example 2: Script containing New-TpmsObjTcpIpPortLpr

The following script creates ten printers which are defined in a .csv file with Standard TCP/IP Ports (Protocol option set to LPR).

  • The definition file network-printers.csv:
"Selected","PrinterName","PortName","Address","DriverName","TemplateName" 
"1","PRN01-BLN","PRN01-BLN:","192.168.209.203","Lexmark T644 (MS)","Lexmark T644" 
"1","PRN02-PRS","PRN02-PRS:","192.168.149.125","Kyocera FS-C8500DN","Kyocera FS-C8500DN" 
"1","PRN03-WRS","PRN03-WRS:","192.168.149.127","Canon LBP7660C Class Driver","Canon LBP7660C" 
"1","PRN04-PRG","PRN04-PRG:","192.168.149.126","Brother PCL6 Class Driver","Brother" 
"1","PRN05-MSC","PRN05-MSC:","192.168.149.120","Xerox Phaser 6300N","Xerox Phaser 6300N" 
"1","PRN06-LDN","PRN06-LDN:","192.168.149.124","Dell B1265dnf Laser MFP PCL6","Dell B1265dnf Laser MFP" 
"1","PRN07-OSL","PRN07-OSL:","192.168.149.129","HP Color LaserJet 9500 PCL6 Class Driver","HP Color LaserJet 9500" 
"1","PRN08-STK","PRN08-STK:","192.168.149.123","KONICA MINOLTA PS Color Laser Class Driver","KONICA MINOLTA PS Color Laser" 
"1","PRN09-KPN","PRN09-KPN:","192.168.149.128","OKI PCL6 Class Driver","OKI" 
"1","PRN10-BPT","PRN10-BPT:","192.168.149.122","Samsung ML-4555 Series PCL6","Samsung ML-4555"
  • The PowerShell script:
$allports = @() 
$allprinters = @() 
Import-Csv -Path .\network-printers.csv | foreach { 
if($_.Selected -eq 1) 
{ 
$port = New-TpmsObjTcpIpPortLpr -Name $_.PortName -Queue lp0 -HostAddress $_.Address -EnableByteCounting 1 
$printer = New-TpmsObjPrinter -Name $_.PrinterName -Driver $_.DriverName -Port $_.PortName -Template $_.TemplateName 
} 
$allports += $port 
$allprinters += $printer 
} 
$srva = New-TpmsObjApplyAgent -Name "cps47.ourdomain.local" -Port 5050 -Printers ($allprinters) -Ports ($allports) 
Start-TpmsApplyByAgent -Action Deploy -Servers ($srva) | Format-TpmsDispatch

On the target machine cps47.ourdomain.local, the script creates and configures ten Standard TCP/IP Ports – with Protocol option set to LPR – with ten printers connected to them. The queue names are set to lp0, and LPR Byte Counting is enabled. All port and printer settings can be found in the relevant .csv file.
Start-TpmsApplyByAgent -Action Deploy creates ports and printers on the target machine and -Action Remove deletes them.

printers and ports created by Tpms.Agent on the given target machine cps47

printers and ports created by Tpms.Agent on the given target machine cps47

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.