New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Parameters in EXE Notification (execute Script via Notification)

Votes:

0

Your Vote:

Up

Down

Hello!

I'm a PowerShell dummy and in general not great with scripting or programming so I guess this is a simple question for anyone familiar with PS...

I have a very simple script that should be run when an IIS App Pool is down. It looks like this:

Invoke-Command -ComputerName "my_server" -ScriptBlock { Start-WebAppPool -Name "WsusPool" }

Works fine if I set the computername as the DNS name or IP manually in the script. But it would be nicer to feed the script the value of the device that generated the alarm. I tried setting the parameter in the notification settings to '%host' and edited the script to contain -ComputerName "%host" but it didn't work. So how do I tell the script to replace the value for -ComputerName with the value from the parameters from PRTG notification?

Thanks in advance for any help on this!

All the best M.

notifications powershell script

Created on Mar 13, 2019 1:54:05 PM by  MvF (0) 1



1 Reply

Votes:

0

Your Vote:

Up

Down

Hi there,

In the script you need to gather the define possible parameters:

param(
$ComputerName
)

In PRTG put the following in the parameters field:

-ComputerName "%host"

That should already do the trick. Afterwards use "$ComputerName" as the Variable for the host in your script.

Best regards.

Created on Mar 13, 2019 1:59:40 PM by  Dariusz Gorka [Paessler Support]



Please log in or register to enter your reply.


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.