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

PrtgAPI Powershell set-objectproperty

Votes:

0

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

api powershell prtg

Created on May 8, 2020 7:53:42 AM



Best Answer

Accepted Answer

Votes:

1

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

Created on May 8, 2020 9:30:43 AM



2 Replies

Votes:

0

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.

Created on May 8, 2020 9:08:27 AM by  Moritz Heller [Paessler Support]



Accepted Answer

Votes:

1

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

Created on May 8, 2020 9:30:43 AM




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.