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

How to get pass a parameter to ps1 script from Sensor exe

Votes:

0

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.

exe prtg ps1 sensor

Created on Dec 21, 2022 2:07:20 PM



1 Reply

Votes:

0

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.

Created on Dec 29, 2022 3:37:31 PM by  Mike Payne [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.