Example 3: Script containing New-TpmsObjVLayerPair
Description
Defines a model for a V-Layer pair (of a native printer and an Output Gateway printer as well as the appropriate printer ports). The model is represented by a container that predefines all printers and 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.
Requirement
- ThinPrint Engine
Syntax
New-TpmsObjVLayerPair -Name <string> -Printer <string>
Parameter | Description |
-Name | Output Gateway printer (object) |
-Printer | native printer (object) |
Example 1: cmdlet usage
The following example defines the V-Layer pair Lexmark T644 (as the native printer) and TpmsTestPrinter (as the Output Gateway printer). Here, the Output Gateway printer is connected to the printer port TpmsTestPort:
See also New-TpmsObjPrinter and New-TpmsObjPrinterTpog for defining printer variables as well as New-TpmsObjTcpIpPortRaw and New-TpmsObjTpPortTcp for defining port variables.
New-TpmsObjVLayerPair -Name TpmsTestPrinter -Printer "Lexmark T644"
Example 2: cmdlet usage
The following example defines the V-Layer pair Lexmark T644 (as the native printer) and TpmsTestPrinter (as the Output Gateway printer) and writes this setting to the variable $vlayer.
See also New-TpmsObjApplyAgent for advice on using the $vlayer variable.
$vlayer = New-TpmsObjVLayerPair -Name TpmsTestPrinter -Printer "Lexmark T644"
Example 3: Script containing New-TpmsObjVLayerPair
The following script creates four pairs of V-Layer printers: four Output Gateway printers connected to Standard TCP/IP Ports and four printers with native drivers connected to ThinPrint Ports (TCP/IP type). The printer information is retrieved from a ThinPrint Client – here: client701.
The properties of the Output Gateway printer objects are retrieved from the template TP Output Gateway color – however, the ones of the native printers from the ThinPrint Client.
$allports = @() $nprinters = @() $tpogprinters = @() $allprinters = @() $vlayers = @() $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 $allprinters += New-TpmsObjPrinter -Name ([string]::Format("{0}#client701:{1}", $printer, $printerid)) -Port ([string]::Format("ThinPort{0:D3}:", $portnum)) -Driver $_.DrvName -Template $_.DrvName $allprinters += New-TpmsObjPrinterTpog -Name ($printer) -Port ([string]::Format("TPOG{0:D3}:", $portnum)) -Template "TP Output Gateway color" $allports += New-TpmsObjTpPortTcp -TcpPort 4000 -Name ([string]::Format("ThinPort{0:D3}:", $portnum)) $allports += New-TpmsObjTcpIpPortRaw -PortNumber 9100 -HostAddress "127.0.0.1" -Name ([string]::Format("TPOG{0:D3}:", $portnum)) $vlayers += New-TpmsObjVLayerPair -Name ($printer) -Printer ([string]::Format("{0}#client701:{1}", $printer, $printerid)) $portnum += 1 } else { $_ } } $srvb = New-TpmsObjApplyAgent -Name "cps47.ourdomain.local" -Port 5050 -Printers ($allprinters) -Ports ($allports) -VLayerConnections ($vlayers) 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.
Printers folder on the central print server: four V-Layer printer pairs created by the script above – e. g. Output Gateway printer OKI C5510@branch02 and native printer OKI C5510@branch02#client701:2
V-Layer Manager: four V-Layer pairs (created by the script above): highlighted by an orange printer icon
printers in the ThinPrint Client Manager on client701
Printers folder on the central print server: template printers before running the script
Creating a V-Layer on a ThinPrint Port
Creating a V-Layer in which both printer objects are shared