New-TpmsObjTpPortTcp

60 views 0

Description

Defines a model for a TCP/IP type1 ThinPrint Port. 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.

Requirements

  • ThinPrint Engine
  • ThinPrint Clients (TCP/IP type)

path of print data with ThinPrint TCP/IP printing to local print servers or gateway appliances

 

path of print data with ThinPrint TCP/IP printing to workstations or thin clients

Syntax

New-TpmsObjTpPortTcp -Name <string> -TcpPort <uint16> [-BandwidthCtrl <uint32>] [-IsEncrypted <boolean>] [-Compression <CompressionOpt>] [-PackageSize <uint32>] [-Scheme <SchemeVersion>] [-Version <uint32>]

Parameter Description
-Name name of printer port being created; the port name must end with a colon ( : ), examples:

TcpIpPort: or “TcpIp Port:”

-TcpPort TCP port for opening a connection to a ThinPrint Client (default: 4000)
-BandwidthCtrl bandwidth for printing limited to 1–10,000 kbit/s (kbps); see Bandwidth control; default: unlimited

Up to installer version 1.0.53 or 1.0.61, the value had to be given in bps instead of kbps.

-IsEncrypted enables SSL encryption (default: 0)

1: enabled

0: disabled
see Use encryption

-Compression compression level

{Disabled | Level0 | Level1 | BestSpeed | Level2 | Level3 | Level4 | Level5 | Lev­el6 | Default | Level7 | Level8 | Level9 | BestCompression}
For Level9 see Minimum print data volume.

-PackageSize size of IP datagrams (in Byte) to be sent to the ThinPrint Client (default: 65535)
-Scheme Old: printer naming convention

ClientAddress:PrinterId#PrinterName

New: printer naming convention

PrinterName#ClientAddress:PrinterId

(default)

-Version ThinPrint Port Monitor version (default 151257685). Until ThinPrint Engine 11.2, this parameter was optional. Since ThinPrint Engine 12 it’s mandatory. Otherwise, no ThinPort will be created.

Version number for ThinPrint Engine 12: 201326598

ThinPrint Port settings: TCP/IP (sockets) port type (Tcp)

ThinPrint Port settings: Naming convention

Example 1: cmdlet usage

The following example defines a ThinPrint Port with the denomination Tcp:, the print protocol ThinPrint TCP/IP with the TCP port 4000, bandwidth limited to 256 kbit/s (kbps), no encryption, the compression level 5 and an IP package size of 128 KByte. These settings will be written to the variable $port.

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

$port = New-TpmsObjTpPortTcp -Name Tcp: -TcpPort 4000 -BandwidthCtrl 256 -IsEncrypted 0 -Compression Level5 -PackageSize 131071

Example 2:

Script containing New-TpmsObjTpPortTcp (for creating ThinPrint Ports without printers or drivers)

The following script creates a number of ThinPrint Ports. The number of ports can be determined with the variable $portnumber and the port name with $portname. The bandwidth and encryption options can be additionally specified.

The address of the target machine must be given with the variable $servername.

$servername = "cps47.ourdomain.local"

$portname = "Paris"

$portnumber = 2

$encrypted = 0

$bandwidth = 256

$ports = @()

For($j=0; $j -lt $portnumber; $j+=1){

$ports += New-TpmsObjTpPortTcp -TcpPort 4000 -Name ([string]::Format("{0}{1:D3}:", $portname, $j)) -IsEncrypted $encrypted -BandwidthCtrl $bandwidth

}

$srv = New-TpmsObjApplyAgent -Name $servername -Port 5050 -Ports ($ports)

Start-TpmsApplyByAgent -Action Deploy -Servers ($srv) | Format-TpmsDispatch

Start-TpmsApplyByAgent -Action Deploy creates the ports Paris000 and Paris001 on the target machine and -Action Remove deletes them.

creating two ThinPrint Ports on cps47.ourdomain.local

Example 3:

Script containing New-TpmsObjTpPortTcp (for Native Printing)

The following script creates and shares a number of ThinPrint printers with native drivers – each connected to a TCP/IP type ThinPrint Port. The printer information is retrieved from a specific ThinPrint Client running on client701. The printer properties are retrieved from the templates of the relevant native drivers.

For each printer retrieved from the ThinPrint Client a relevant ThinPrint printer with a native driver as well as a ThinPrint Port is created. Encryption is enabled in the ThinPrint Port configuration.

$allports = @()

$printers = @()

$allprinters = @()

$client = New-TpmsObjTpClient -Name client701 -Port 4000

$srva = New-TpmsObjQueryAgent -Name "cps47.ourdomain.local" -Port 5050 -ClientQueries ($client)

$printerlists = Start-TpmsQueryByAgent -Servers ($srva) | Format-TpmsDispatch

$portnum = 0

$printerlists | foreach {

if ($_ -is [ThinPrint.Tpms.Common.TpSrcPrn])

{

$printer = $_.Name

$printerid = $_.Id

$printers = New-TpmsObjPrinter -Name ([string]::Format("{0}#client701:{1}", $printer, $printerid)) -Port ([string]::Format("ThinPort{0:D3}:", $portnum)) -Driver $_.DrvName -Template $_.DrvName

Add-TpmsSharingInfo -Printers ($printers) -Name $_.Name -Mode Network

$allprinters += $printers

$allports += New-TpmsObjTpPortTcp -TcpPort 4000 -Name ([string]::Format("ThinPort{0:D3}:", $portnum)) -IsEncrypted 1

$portnum += 1

}

else

{

$_

}

}

$srvb = New-TpmsObjApplyAgent -Name "cps47.ourdomain.local" -Port 5050 -Printers ($allprinters) -Ports ($allports)

Start-TpmsApplyByAgent -Action Deploy -Servers ($srvb) | Format-TpmsDispatch

Start-TpmsApplyByAgent -Action Deploy creates ports and printers on the target machine and -Action Remove deletes them.

Note! Always run Add-TpmsSharingInfo together with New-TpmsObjPrinter or New-TpmsObjPrinterTpog – i. e., not with separate scripts.

printers in the ThinPrint Client Manager on client701

Printers folder on the central print server: template printers before running the script

Printers folder on the central print server: template printers as well as four ThinPrint printers (with native drivers) created and shared by the script above

ThinPrint Port Manager: template printers connected to ThinPort: as well as ThinPrint printers connected to four ThinPrint TCP/IP Ports created by the script above

1 Print data are sent – bandwidth controlled and compressed – directly to ThinPrint Clients, using the ThinPrint TCP/IP pro­tocol

Previous Page
Next Page

Was this helpful?