Logging

49 views 0

To enable logging, use the cmdlet Out-File. To test the usage, you can put the command lines of the example in the section Creating the printer to a script (see below). Using Out-File, its output will be written to the log file Tpms.log. Additionally, it’s necessary to add the current date to this log file with Date | Out-File.

$port = New-TpmsObjTcpIpPortRaw -Name Lexmark: -PortNumber 9100 -HostAddress "192.168.209.204"

$printer = New-TpmsObjPrinter -Name "Lexmark T644" -Driver "Lexmark T644 (MS)" -Port Lexmark:

$srv = New-TpmsObjApplyAgent -Name "tpms002.ourdomain.local" -Port 5050 -Printers ($printer) -Ports ($port)

Date | Out-File -FilePath "c:\logs\Tpms.log" -Append 

Start-TpmsApplyByAgent -Action Deploy -Servers ($srv) | Out-File -FilePath "c:\logs\Tpms.log" -Append

See also the section Log levels.

Previous Page
Next Page

Was this helpful?