Closed mrpowershell closed 4 years ago
Hi @mrpowershell,
The issue is that the timetable
variable is not supposed to be a string
, but rather a list of integer
s
On the wiki there is the following example on how to do this
# Enable monitoring across all hours of the week
Get-PrtgSchedule -Id 620 | Set-ObjectProperty -RawParameters @{
timetable = 0..167
timetable_ = ""
}
In the code timetable = 0..167
, 0..167
uses range syntax to specify "all the integers between 0 and 167"
As such, in your scenario you should be able to set the timetable of the object as follows
$schedulevalues = 13,14,18,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,61,62,66,85,86,90,109,110,114,132,133,134,135,138,139,156,157,158,159,162,163
Get-PrtgSchedule -Id $id | Set-ObjectProperty -Force -RawParameters @{ timetable = $schedulevalues timetable_ = "" }
Regards, lordmilko
Dear team,
I'm currently working on a program that uses the API here to automatically adjust the schedules according to holidays and special days which can be controlled in a GUI. The logic of the program is finished so far, but I fail at this point to pass the data to PRTG:
For example: According to the userinput, i generate a variable $schedulevalues with the content, 14,13,25,26,60
$schedulevalues is in powershell per definition a STRING
When i know try to run this code:
Get-PrtgSchedule -Id $id | Set-ObjectProperty -Force -RawParameters @{ timetable = $schedulevalues timetable_ = "" }
i get the following error:
do you have any idea how to solve this?