Example 4: Script containing Set-TpmsLogLevel
Description
Enables retrieving log information from the target machines (on which Tpms.Agent runs) and displaying it using PowerShell.
The parameter RelayLogLevel defines the – lowest – log level to be communicated. It’s set accordingly to the nlog standard. For more information see nlog-project.org/documentation
Syntax
Set-TpmsLogLevel -RelayLogLevel <string>
Parameter | Description |
-RelayLogLevel | This parameter allows the following values: Off | Fatal | Error | Warn | Info | Debug | Trace |
Example 1: cmdlet usage
The following example enables retrieving log information of Fatal, Error, Warn and Info level from Tpms.Agent.
Set-TpmsLogLevel -RelayLogLevel Info
Example 2: cmdlet usage
The following example enables retrieving log information of Fatal and Error level from Tpms.Agent.
Set-TpmsLogLevel -RelayLogLevel Error
Example 3: cmdlet usage
The following example disables retrieving log information from Tpms.Agent.
Set-TpmsLogLevel -RelayLogLevel Off
Example 4: Script containing Set-TpmsLogLevel
The following script can be run on an admin computer to initiate the Tpms environment. The script must run only once per session. It imports the module Tpms.Powershell, sets the URL of Tpms.Service and sets the log level to Info, defines a target server ($srv2) running Tpms.Agent (cps47.ourdomain.local) and – finally – sends the relevant calls with Start-TpmsSetupByAgent -Servers ($srv2).
Set-TpmsServiceUrl -Uri https://licenseserver.ourdomain.local:4040 Set-TpmsLogLevel -RelayLogLevel Info $srv2 = New-TpmsObjSetupAgent -Name "cps47.ourdomain.local" -Port 5050 -Credential (Get-Credential -Message "Please enter your credentials." -UserName "ourdomain\Administrator") Start-TpmsSetupByAgent -Servers ($srv2)