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 can I get my powershell script to post into prtg?



I have wrote a PowerShell script to use the "HTTP Push Data Advanced" sensor:

$prtgresult = '<prtg>
            </prtg> '

Add-Type -AssemblyName system.web
$Answer = Invoke-WebRequest `
   -method "POST" `
   -URI ("http://***IPof PRTG_Server***:5050/***Token***") `
   -ContentType "text/xml" `
   -Body ([System.Web.HttpUtility]:: UrlEncode.($prtgresult)) `
if ($answer.statuscode -ne 200) {
   write-warning "Request to PRTG failed"
   exit 1
else {

I get back a message saying it matched 1 sensor but the sensor is saying "No Data" (I tried adding the HTTP Push Count with the same Token and to matched 2 sensors and I could see it in the Push Count log as picking it up) so I'm now completely stuck and I'm sure I've missed something but I can't figure out what :(

The end result should be that whenever the sensor receives the push message it triggers a "Change Notification" to alert our out of hours support team with the contents on the Text Tag.

http powershell prtg

Created on Nov 15, 2018 2:30:38 PM

Last change on Nov 15, 2018 3:05:31 PM by  Stephan Linke [Paessler Support]

3 Replies



Hi there,

Do you run multiple Push Data sensors all under the same Port?

Please create an entirely new Push Data Advanced Sensor with a different port and Identification Token, does the script work properly then?

Best regards.

Created on Nov 16, 2018 1:19:19 PM by  Dariusz Gorka [Paessler Support]



Still not working I'm afraid:

I get the response that its matched the Sensor but on the sensor I get "There was no value provided"

the log file shows:

Command: POST ContentType: text/xml Uri: /Token Remote IP: .*.. Form Params: Query Params: Version: HTTP/1.1

Created on Dec 6, 2018 4:51:35 PM



Hi there,

Found the issue. You are just transmitting the result in the POST-Body, but you are missing the parameter that this result belongs to. So change this:

-Body ([System.Web.HttpUtility]:: UrlEncode.($prtgresult)) `

To this:

-Body ("content="+[System.Web.HttpUtility]:: UrlEncode.($prtgresult)) `

Basically you need to transmit the result in the "content"-Parameter.

Best regards.

Created on Dec 6, 2018 8:44:38 PM by  Dariusz Gorka [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.