Hi PRTG,

I search for a command, who set in a bulk a scheduled maintenance window to a set of sensors.

I tried:

Get-probe -name "*probename*" | Get-Device -Name "*devicename*" | Get-Sensor -Tags xmlexesensor | set-ObjectProperty

But i see not the parameter "scheduled"

With Get-Device -Name "*device*" | Get-Sensor -Tags xmlexesensor | select schedule I can sk for the parameter, bu I cannot set..

Any Ideas?

Thanx

Carsten


Article Comments

Hi Carsten,

You can simply use the call "/api/pauseobjectfor.htm?id=objectid&pausemsg=yourmessage&duration=x" to pause the Sensor for a certain time.


May, 2020 - Permalink

Hi Carsten,

PrtgAPI is a third party library not supported by Paessler, so you should ask any questions regarding PrtgAPI on the PrtgAPI issues page

Properties in the Schedules, Dependencies, and Maintenance Window section of PRTG are not natively supported by PrtgAPI, however you can still accomplish this by using the -RawParameters parameter

The following demonstrates how to set a maintenance window on the sensor with ID 1001 between now and an hour from now

Get-Sensor -Id 1001| Set-ObjectProperty -RawParameters @{
    maintstart_ = ((Get-Date).ToString("yyyy-MM-dd-HH-mm-ss"))
    maintend_ = ((Get-Date).AddHours(1).ToString("yyyy-MM-dd-HH-mm-ss"))
    maintenable_ = 1
    scheduledependency = 0
} -Force

Regards, lordmilko


May, 2020 - Permalink