Three-step architecture
Step 1
– specifies settings using the Add-Tpms, New-Tpms or Set-Tpms cmdlets
or
– retrieves data from different sources (e. g. from files, databases or ThinPrint Clients)
Step 2
– collects all settings and writes them to a data package (using variables)
Step 3
– 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.
Initiating Tpms.Powershell
On the admin computer, run PowerShell as administrator from Windows’ Start menu.
Step 1
– 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.
Step 3
– 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
Step 1
– 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:
Step 2
– 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)
Step 3
– 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
Step 3
– Remove the printer created above with:
Start-TpmsApplyByAgent -Action Remove -Servers ($srv) | Format-TpmsDispatch
For more examples see the sections Practice and Cmdlets.
1 on which Tpms.Agent is installed, here: tpms002.ourdomain.local