Example 2: script containing New-TpmsObjTpPortVcg (for Driver Free Printing)
Description
Defines a model for a Virtual Channel Gateway 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.
Note! Please also refer to the section Connecting printers to ThinPrint Ports.
Requirements
- ThinPrint Engine
- ThinPrint Clients (RDP or ICA type) or VMware Horizon View environment
path of print data with Virtual Channel Gateway printing
Syntax
New-TpmsObjTpPortVcg -Name <string> -TcpPort <uint16> [-BandwidthCtrl <uint32>] [-IsEncrypted <boolean>] [-Compression <CompressionOpt>] [-PackageSize <uint32>] [-Scheme <SchemeVersion>] [-Version <uint32>]
Parameter | Description |
-Name | printer port name to be created; the port name must end with a colon ( : ), examples: VcgPort: or "Vcg Port:" |
-TcpPort | TCP port to open a connection to a Virtual Channel Gateway (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 |
-Compression | compression level {Disabled | Level0 | Level1 | BestSpeed | Level2 | Level3 | Level4 | Level5 | Level6 | Default | Level7 | Level8 | Level9 | BestCompression} |
-PackageSize | size of IP datagrams (in Byte) to be sent to the ThinPrint Client (default: 65535) |
-Scheme | Old : printer naming convention UserName:PrinterId#PrinterName New : printer naming convention PrinterName#UserName:PrinterId (default) see Naming convention |
-Version | optional: ThinPrint Port Monitor version (default: 151257685) |
ThinPrint Port settings: Use Virtual Channel Gateway port type (Vcg)
ThinPrint Port settings: Naming convention
Example 1: cmdlet usage
New-TpmsObjTpPortVcg -TcpPort 4000 -BandwidthCtrl 256 -IsEncrypted 0 -Compression Default -Name Vcg:
Defines a ThinPrint Port with the denomination Vcg:, the Use Virtual Channel Gateway type with the TCP port 4000, bandwidth limited to 256 kbit/s (kbps), no encryption and the default compression level.
Example 2: script containing New-TpmsObjTpPortVcg (for Driver Free Printing)
The following script creates and shares a number of ThinPrint printers with TP Output Gateway as driver (called Driver Free Printing) – each with a Virtual Channel Gateway type ThinPrint Port. The printer information is retrieved from the .csv file vcg-printers.csv. The printer properties are retrieved from the template TP Output Gateway.
For each printer read from the definition file a relevant ThinPrint printer with TP Output Gateway as well as a ThinPrint Port is created.
- The definition file vcg-printers.csv:
"Selected","PrinterName","PortName" "1","homeoffice","homeoffice:" "1","branchoffice01","branchoffice01:" "1","branchoffice02","branchoffice02:" "1","branchoffice03","branchoffice03:"
- The PowerShell script:
$allports = @() $printers = @() $allprinters = @() $portnum = 0 Import-Csv -Path .\vcg-printers.csv | foreach { if($_.Selected -eq 1) { $allports += New-TpmsObjTpPortVcg -Name ([string]::Format("ThinPort{0:D3}:", $portnum)) -TcpPort 4000 $printer = $_.PrinterName $printers = New-TpmsObjPrinterTpog -Name ($printer) -Port ([string]::Format("ThinPort{0:D3}:", $portnum)) -Template "TP Output Gateway" Add-TpmsSharingInfo -Printers ($printers) -Name $_.PrinterName -Mode Network $allprinters += $printers $portnum += 1 } } $srva = New-TpmsObjApplyAgent -Name "cps47.ourdomain.local" -Port 5050 -Printers ($allprinters) -Ports ($allports) Start-TpmsApplyByAgent -Action Deploy -Servers ($srva) | 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 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 TP Output Gateway as driver) created and shared by the script above
ThinPrint Port Manager: template printers connected to ThinPort: as well as ThinPrint printers connected to four ThinPrint VCG Ports created by the script above
1 Print data are sent – bandwidth controlled and compressed – to Remote Desktop sessions and then are delivered via the session protocol (Microsoft RDP, Citrix ICA or VMware PCoIP).