I have this ps1 script. I would like to pass a unique parameter to the script I have put on the probe.

The script is as follows:

$vaerdi=(Select-String -Path '
$($args[0])\JBoss_DS\ModulusCore.txt' -Pattern '(?result" => )\d+').Matches.Value write-output "$($vaerdi):OK)

If I substitute $($args[0]) with the servername, in the ps1 script, it works. But I can't get PRTG to understand that its the parameter from the sensor I wants as argument. What is the syntax? I have read you manual, but it didnt help.


Article Comments

Hi there, thanks for you question. You could try this instead -

param ( [string]$ComputerName = $env:computername )

If you give the sensor the right parameters, this should work for you.


Dec, 2022 - Permalink