Open navigation

New-TpmsObjPrinterTpog

Description

Requirement

Syntax

Example 1: cmdlet usage

Example 2: cmdlet usage

Example 3: Script containing New-TpmsObjPrinterTpog



Description

Defines a model of printers which use TP Output Gateway as driver (= Output Gateway printers). The model is represented by a container that predefines all printers 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-TpmsObjPrinterTpog -Name <string> -Port <string> [-Template <string>] [-NamePattern <TpogNamePattern>] 
ParameterDescription
-Name

printer name (to be created), examples:

Testprinter or "Lexmark T644#192.168.149.14:2"

-Port

(ThinPrint) printer port name, examples:

Testport: or "Test port:"

$port.name or ($port.name)

-Template

Output Gateway printer object the specific driver properties are to be retrieved from

If the template is on a remote machine, its name must be specified with FQDN address. Example: -Template "\\cps48.ourdomain.local\TPOG-01".
The service of the Tpms.Agent that creates the printers must run with an account that has the permission to access the share of the template located on the remote computer.

-NamePatternformat string, uses regular expressions


Example 1: cmdlet usage

New-TpmsObjPrinterTpog -Name "Lexmark T644#192.168.149.14:2" -Port ThinPort: -Template "\\cps48.ourdomain.local\TPOG-01" -NamePattern "%*[^#]#%[^:]:%s"

Defines the Output Gateway printer Lexmark T644#192.168.149.14:2, connects it to the default ThinPrint Port and assigns TP Output Gateway as driver. The native driver settings will be retrieved from the template printer object TPOG-01 on a remote machine.

While printing ThinPrint will search in the printer name (-Name) for the address of the print target using the regular expressions of the -NamePattern parameter.


Example 2: cmdlet usage

$printer = New-TpmsObjPrinterTpog -Name TpmsTestPrinter -Port TpmsTestPort:

Defines the Output Gateway printer TpmsTestPrinter, connects it to the printer port TpmsTestPort:, assigns TP Output Gateway as driver and writes this setting to the variable $printer. For retrieving the native driver properties the settings are assigned using Add-TpmsClientInfo.

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


Example 3: Script containing New-TpmsObjPrinterTpog

The following script creates as many printers as are enabled on the ThinPrint Client on client701 which is defined in the file settings.csv. Furthermore, the driver properties are retrieved from client701 using Add-TpmsClientInfo and assigned to the (new) Output Gateway printer objects. These printers are shared using Add-TpmsSharingInfo.

  • The definition file settings.csv:
"ServiceUri","AgentAddress","AgentPort","TpClientAddress","TpClientPort" 
"https://tpms002.ourdomain.local:4040","tpms002.ourdomain.local",5050,client701,4000
  • The PowerShell script:
$allports = @() 
$printers = @() 
$allprinters = @() 
Import-Csv -Path .\settings.csv | foreach { 
$clientaddr = $_.TpClientAddress 
$clientport = $_.TpClientPort 
$client = New-TpmsObjTpClient -Name ($clientaddr) -Port ($clientport) 
$srva = New-TpmsObjQueryAgent -Name $_.AgentAddress -Port $_.AgentPort -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-TpmsObjPrinterTpog -Name ([string]::Format("{0}#{1}:{2}", $printer, $clientaddr, $printerid)) -Port ([string]::Format("ThinPrint{0:D3}:", $portnum)) -Template "TP Output Gateway color" 
Add-TpmsClientInfo -Printers ($printers) -Name ($clientaddr) -Port ($clientport) -PrinterId $_.Id 
Add-TpmsSharingInfo -Printers ($printers) -Name $_.Name -Mode Network 
$printers 
$allprinters += $printers 
$allports += New-TpmsObjTpPortTcp -TcpPort ($clientport) -Name ([string]::Format("ThinPrint{0:D3}:", $portnum)) 
$portnum += 1 
} 
else 
{ 
$_ 
} 
} 
Import-Csv -Path .\settings.csv | foreach { 
$srvb = New-TpmsObjApplyAgent -Name $_.AgentAddress -Port $_.AgentPort -Printers ($allprinters) -Ports ($allports) 
} 
Start-TpmsApplyByAgent -Action Deploy -Servers ($srvb) | Format-TpmsDispatch

Did you find it helpful? Yes No

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