Open navigation

New-TpmsObjPrinter

Description

Syntax

Example 1: cmdlet usage

Example 2: cmdlet usage

Example 3: Script containing New-TpmsObjPrinter for Standard TCP/IP Ports

Example 4: script for ThinPrint Ports



Description

Defines a model for printers which uses a native driver (= native 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.

Note!  Please also refer to the section Connecting printers to ThinPrint Ports.


Syntax

New-TpmsObjPrinter -Name <string> -Driver <string> -Port <string> [-Template <string>] 
ParameterDescription
-Name

printer name (to be created), examples:

Testprinter or "HP Color LaserJet 4700"

-Driver

printer driver, example: "HP Universal Printing PS"

Note: Don’t use type-4 drivers if the relevant printers are to be con­nected to ThinPrint Ports – i. e., using New-TpmsObjTpPortTcp, New-TpmsObjTp­PortLpr, New-TpmsObjTpPortCon, New-TpmsObjTpPortVcg or New-TpmsObjTpPort­Vcp.

-Port

printer port name, examples:

Testport: or "Test port:"

$port.name or ($port.name) or $_.PortName (see below)

-Templateprinter object the specific driver settings 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\_Tpl_Lexmark T644".

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.


Example 1: cmdlet usage

The following example defines the native printer Lexmark T644#192.168.149.14:2, connects it to the default ThinPrint Port and assigns the driver Lexmark T644 (MS). The driver settings will be retrieved from the template printer object _Tpl_Lexmark T644 on the same machine.

New-TpmsObjPrinter -Name "Lexmark T644#192.168.149.14:2" -Driver "Lexmark T644" -Port ThinPort: -Template "_Tpl_Lexmark T644"


Example 2: cmdlet usage

The following example defines the native printer TpmsTestPrinter, connects it to the printer port TpmsTest­Port:, assigns the driver HP Color LaserJet 3600 and writes this setting to the variable $printer.

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

$printer = New-TpmsObjPrinter -Name TpmsTestPrinter -Driver "HP Color LaserJet 3600" -Port TpmsTestPort:


Example 3: Script containing New-TpmsObjPrinter for Standard TCP/IP Ports

The following script creates ten printers with Standard TCP/IP Ports which are defined in a .csv file.

  • 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-TpmsObjTcpIpPortRaw -Name $_.PortName -PortNumber 9100 -HostAddress $_.Address 
$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 ten printers connected to them. 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

 

Example 4: script for ThinPrint Ports

See the script example for New-TpmsObjTpPortTcp.


Did you find it helpful? Yes No

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