PrtgAPI icon indicating copy to clipboard operation
PrtgAPI copied to clipboard

Set-ObjectProperty

Open noaboa97 opened this issue 1 year ago • 3 comments

Describe the bug

Hello lordmilko

I hope you are doing well.

Cannot update Schedules, Dependencies, and Maintenance Window to inherit or stop inheritance via set-objectproperty. Setting Scanning Interval for example works.

We would like to unset inheritance and also set the dependecyvalue and dependencytype.

Here's the wiki article: https://github.com/lordmilko/PrtgAPI/wiki/Property-Manipulation Setting a schedule also doesn't work.

It seems like PRTG is not accepting the input. It's not shown in the webinterface an also not with get-objectproperties.

We run PRTG Version: 23.4.88.1429

Steps to reproduce

$sensor = get-sensor -name XY

$ht = @{
    "scheduledependency" = 0
    "dependencyvalue" = "78632"
    "dependencytype" = 1  
}

$sensor | Set-ObjectProperty -RawParameters $ht -Force

What is the output of 'Get-PrtgClient -Diagnostic'?

PSVersion      : 5.1.17763.5328
PSEdition      : Desktop
OS             : Microsoft Windows Server 2019 Standard
PrtgAPIVersion : 0.9.19
Culture        : de-CH
CLRVersion     : .NET Framework 4.8 (528049)
PrtgVersion    : 23.4.88.1429
PrtgLanguage   : english.lng

Additional context

No response

noaboa97 avatar Feb 27 '24 12:02 noaboa97

We are having a similar issue since upgrade to 24.1.90.1306 from our previous v23. This had been working flawlessly:

$device | Set-ObjectProperty -rawparameters @{
	scheduledependency=0
	maintenable_=1
	maintstart_=$startString
	maintend_=$endString
} -force -EA Stop

PS>TerminatingError(Set-ObjectProperty): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: PRTG was unable to complete the request. The server responded with the following error: The validation of the data you entered has failed. ." Result : FAILED - PRTG was unable to complete the request. The server responded with the following error: The validation of the data you entered has failed. .

LemurTech avatar Mar 11 '24 23:03 LemurTech

It's possible there's an additional parameter that needs to be specified when you execute this request. I recommend using Fiddler Classic to trace what the PRTG UI does, and then test adding in additional parameters that may be relevant to this section

lordmilko avatar Mar 11 '24 23:03 lordmilko

It looks like the acceptable date format for maintstart_ and maintend_ has changed!

Before: "2024,03,11,22,00,00" Now: "2024-03-11 22:00:00"

Back in business!

LemurTech avatar Mar 12 '24 00:03 LemurTech