I have made a custom sensor that uses a Powershell script to show the file version of an executable, the script is below:

(Get-Command "C:\XXX\XXX\XXX\XXX.exe").FileVersionInfo.Fileversion

Using this, the version does display correctly in the monitor. However, it displays in an error state. How do I make it so that it no longer is an error, but still displays the file version of an executable?

Much appreciated in advanced.


Article Comments

Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.

Hi,
please note that PRTG expects a specific format for return values:

value:message

In your case the script has to look something like this:

@echo off

$return_fileversion = (Get-Command "C:\XXX\XXX\XXX\XXX.exe").FileVersionInfo.Fileversion
echo $return_fileversion + ":OK"

For further documentation please go, in your PRTG installation, "Setup" -> "PRTG API". Best Regards


Feb, 2012 - Permalink