I have stumped Support with this one.

I want to create an EXE Custom Sensor to run a WMI command against a remote server that returns back the number of patches applied in the last X number of days. I have set the Parameters to %host, see it as $args[0] in my powershell script but cannot use it in -computername field for it to return any value. This works fine from command line and passing in the argument. From PRTG, it only returns the value of $srv.

$srv = $($args[0])
$ans = gwmi win32_quickfixengineering -cn $srv
$output = "$srv $ans"
$output | out-file "c:\windows\temp\PRTG.out" -append

Article Comments

Hi there,

did you already checked whether the parameter are correctly transferred to the script from PRTG? We recommend to use a "param" field to transfer values from PRTG to the script, e.g.:

 param(
    $args
  )

Aug, 2021 - Permalink

Couple of things and this is now fixed.

  1. I used to use the parameter of %host when setting up the sensor
  2. $srv = $($args[0]) is what I used to capture the server name of the device that I want to run the sensor on.
  3. The PROBE itself, must be running as a user account that has access to do what you want the script to do. By default, the PROBE service is running as SYSTEM.

I now have a sensor to report back if patches have been applied in the last 30 days.


Aug, 2021 - Permalink

Hi Adam,

Thank you for the update.

Sounds like the Sensor works now. If you have a new issue with this Sensor, I recommend to open a ticket via an email to "support@paessler.com".


Sep, 2021 - Permalink