What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags

View all Tags

Im looking to log a count of a error



I have this powershell below - that will return a count = 4 I wanted to just pass that though to a prtg sensor then on that sensor set the threshold once I have a baseline

$Events = Get-WinEvent -logname "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" | where {($_.Id -eq "36")}


Is this possible

exe prtg ps1

Created on Oct 7, 2021 12:17:16 PM

1 Reply




Thank you for your message.

You can indeed developed a script to count the number of specific events on a target machine and monitor that value with PRTG.

To do so, you need to execute the command remotely on the target device and provide all the information you need to the script from PRTG via the parameter fields. For example, you can pass the Windows credential to the script with the following parameters/line of code:

  • in PRTG:
"%host" "%windowsuser" "%windowspassword"
  • in the script
Param (
    [string]$host = "",
    [string]$winuser = "",
    [string]$winpass = ""

A credential object will be necessary to use Get-WinEvent on target devices by adding -Credential to that command. Here is an article which explains on how to create this object in PowerShell: https://adamtheautomator.com/powershell-get-credential/

The script must also return the value by following the format indicated in this manual: https://www.paessler.com/manuals/prtg/custom_sensors. In this case, as you only have one value, the format is "value:message". You can use the following command to return the data in PRTG (with variables replaced accordingly):

Write-Output "{0}:{1}" -f $value, $message


Created on Oct 8, 2021 8:18:34 AM by  Florian Lesage [Paessler Support]

Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.