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

PowerShell Notification template parameter



Hello, i have a Powershell Script for the Serinus Alarmserver. In Windows Powershell and ISE i'm able to run the sript with the following parameters:

.\myscript.ps1 my_user my_password myalarm_number mydescription_text

The sript is running on the PRTG Core Server if i open in manually in the PowerShell console. But if i try to trigger it in PRTG within these parameters it wont work.

Is it the wrong format for the parameters??

This is my PowerShell Script: https://pastebin.com/VKwGsDhX

Many thanks

notification parameter powershell question

Created on Jan 7, 2020 7:18:40 AM

12 Replies




Is your first script for PRTG and do have taken a look into the guide for Powershell based custom sensors which you can find here?

Kind regards

Created on Jan 7, 2020 11:04:00 AM by  Marijan Horsky [Paessler Support]



Hello Marijan. yes, it is my first script. This is not a script for a Sensor, this is a script for Notification...

Please have a look to the pastebin. There is the srcipt uploaded. I got this script from Serinus. This is not created by me.

This is what i get in the PS cmnd line: Get-Help .\TriggerSerinusAlarm.ps1 -Detailed

TriggerSerinusAlarm.ps1 [[-username] <Object>] [[-password] <Object>] [[-alarmNumber] <Object>] [[-alarmText] <Object>]

This is the first line of my script: Param($username, $password, $alarmNumber, $alarmText)

If i run the script local at the Machine within this commands: .\TriggerSerinusAlarm.ps1 username password alarmNumber alarmText

In this Case i change username etc to my credentials, alarmNumber to 1234 as example and alarmText to TestAlarm it is successfull, but not from PRTG Core

I can't figure out how to use the parameters for this script.

Created on Jan 7, 2020 12:23:46 PM



Did you actually configure the ExecutionPolicy on the server where PRTG Core Server is running?

Created on Jan 7, 2020 1:58:24 PM by  Stephan Linke [Paessler Support]



Yes, if i open the local PowerShell at the W2k12 Server the Sript is running. This is not a policy problem ...

If i call localy the script with the parameters called above the script is running. But if i set the same parameters in PRTG the script is not working. The Alarm is not triggered in this case.

Is the script wrong? Are some arguments in the parameters needed? maybe like -user or <user> or something else? in the Windows powershell i dont need some paramters like -user ... i write it without - or <->

This is the ps1 Script: https://pastebin.com/VKwGsDhX and the parameters are:

.\TriggerSerinusAlarm.ps1 username password AlarmNumber AlarmText
as example:
.\TriggerSerinusAlarm.ps1 hanswurst mysecurepassword 100001 Testalarm

if i call the Script in the PowerShell the script is working but not in PRTG

Created on Jan 7, 2020 2:26:32 PM

Last change on Jan 8, 2020 8:13:01 AM by  Stephan Linke [Paessler Support]



Just to make sure, if it's running in your PowerShell, but not in PRTG itself, it actually might be a execution policy problem. Please check if the output of Get-ExecutionPolicy in a 32Bit PowerShell (i.e. the x86 version) is either RemoteSigned or Unrestricted.

Created on Jan 8, 2020 9:09:45 AM by  Stephan Linke [Paessler Support]



the script is runningh local at the PRTG Server .... but NOT in the PRTG webinterface .... ?!?! All policy settings are done at the script is running in the local powershell at the server. I do not have problems to run the script at the local Windows Server where PRTG is installed ......

BUT ... if i configure the notification in PRTG, do my choice in the drop down menu "TriggerSerinus.ps1" then add the Paramter in the following field ... test the notification and nothing happens ...

my problem is to configure the parameters .... the same way as in the windows powershell wont work. Please have a look at the beginning thread, there is the sript. Whats worng? Is the sript wrong or are some collumns in the paramters filed needed to trigger it correctly?

Created on Jan 8, 2020 6:51:12 PM



the Get-ExecutionPolicy is unrestricted ....

Created on Jan 8, 2020 7:11:09 PM



Well, since the context is correctly set, please try to encapsulate the parameters in single quotes:

'my_user' 'my_password' 'myalarm_number' 'mydescription_text'

...in the "Paramters" field of the Sensor? Do you have any special characters in the password, like a dollar sign or quotes?

Created on Jan 9, 2020 7:36:55 AM by  Stephan Linke [Paessler Support]



This is what i have configured for the NOTIFICATION, not for a Sensor: a Picture is attached ... https://ibb.co/k60QCRZ

The script is Stored at the Core in c:\Program Files (x86)\PRTG\CustumSensors\EXE

I tried with params like you told me by using 'user' etc or wirhout ' I tried .\TriggerSerinusAlarm.ps1 in front of it and without it.

Nothings worked for me. There is no collum or something else in the username or password. No % no $ no " ....

Created on Jan 9, 2020 12:51:28 PM



Okay, few things wrong here.

  1. The script parameters is missing a starting quote for meinkennwort
  2. Notification scripts go to C:\Program Files (x86)\PRTG Network Monitor\Notifications\EXE

The script should then be listed in the notification template, under Execute Program.

Created on Jan 10, 2020 8:20:40 AM by  Stephan Linke [Paessler Support]



Okay, the ps1 script is available under "execute program"

why is a starting quote missing?? thats all quotes: Param($username, $password, $alarmNumber, $alarmText)

followed by: $authParams = @{ "username"=$username; "password"=$password; "rememberMe" = "false" }

so password isn't missing ...

and in the parameters i will write(you said i have to use ' for user password etc. 'prtguser' 'mypassword' '100005' 'DasisteinTest'

these prtguser and the mypassword are configured at the serinus AlarmServer for login sec-serinus.de

state of sending EXE notification:OK ... Status beim Versenden von EXE:OK

on a local machine the sript is running. There are no quotes missing ... there are no % $ or something els in password or username ...

Created on Jan 13, 2020 3:16:29 PM



Hehe, we're chasing tails here. Could you try the following script instead:

Note the default values for the parameters in the first line. Please edit them to be correct and let me know if PRTG is executing the script properly afterwards.

Created on Jan 14, 2020 12:46:44 PM by  Stephan Linke [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.