– specifies settings using the Add-Tpms, New-Tpms or Set-Tpms cmdlets
– retrieves data from different sources (e. g. from files, databases or ThinPrint Clients)
– collects all settings and writes them to a data package (using variables)
– sends the data package via Tpms.Service to the relevant agents. Then, the agents execute the commands from the package on the local machine.
Below you’ll find an example for using the cmdlets of Tpms.Powershell to create a first printer. This printer will be connected to a Standard TCP/IP Port and a native driver will be assigned. The numbering corresponds to the three steps above. Here, the variable of the data package which contains the settings array is $srv.
The values which must be replaced by your own settings are marked orange.
On the admin computer, run PowerShell as administrator from Windows’ Start menu.
– Specify the address of Tpms.Service:
Set-TpmsServiceUrl -Uri "https://licenseserver.ourdomain.local:4040"
– To display messages, set the logging level to Info:
Set-TpmsLogLevel -RelayLogLevel Info
Steps 1 and 2
– Specify the target machine where Tpms.Agent is installed.
If Tpms.Agent is running locally, enter:
$srv = New-TpmsObjSetupAgent -Name "cps47.ourdomain.local" -Port 5050
If Tpms.Agent is running remotely, enter:
$srv = New-TpmsObjSetupAgent -Name "cps47.ourdomain.local" -Port 5050 -Credential (Get-Credential -Message "Please enter your credentials." -UserName "ourdomain\Administrator")
A window will open. Enter admin credentials of the target machine to be able to retrieve the certificates.
– Send the specified settings to Tpms.Service. This initiates Tpms.Powershell.
The cmdlet Set-TpmsServiceUrl must be run one-time on each admin computer (not with each script).
However, the cmdlet New-TpmsObjSetupAgent must be run one-time for each Tpms.Agent (also not with each script).
Start-TpmsSetupByAgent -Servers ($srv)
Creating the printer
– Specify the Standard TCP/IP Port with IP address (-HostAddress) and TCP port (-PortNumber). The port name should end with a colon ( : ). Here, Lexmark:
$port = New-TpmsObjTcpIpPortRaw -Name Lexmark: -PortNumber 9100 -HostAddress "192.168.209.204"
– Specify printer name (here, Lexmark T644) and driver (here, Lexmark T644 (MS)) as well as the name of the port the printer is to be connected to:
$printer = New-TpmsObjPrinter -Name "Lexmark T644" -Driver "Lexmark T644 (MS)" -Port Lexmark:
– Specify the target machine’s1 address with New-TpmsObjApplyAgent and collect the relevant printer and port settings with the parameters -Printers and -Ports:
$srv = New-TpmsObjApplyAgent -Name "tpms002.ourdomain.local" -Port 5050 -Printers ($printer) -Ports ($port)
– Send the specified data package to Tpms.Service which forwards it to the relevant Tpms.Agent. The agent will create port and printer and connect the printer to the port.
Deploy enables this action – i. e., printer and port will be created. Remove disables it – i. e., printer, port and/or driver will be removed (see below). Format-TpmsDispatch displays the output in table form:
Start-TpmsApplyByAgent -Action Deploy -Servers ($srv) | Format-TpmsDispatch
Removing the printer
– Remove the printer created above with:
Start-TpmsApplyByAgent -Action Remove -Servers ($srv) | Format-TpmsDispatch
1 on which Tpms.Agent is installed, here: tpms002.ourdomain.local