Closed blamm159 closed 3 years ago
Hi @blamm159,
This is expected behavior. PRTG does not support the direct retrieval for "inheritance" related properties.
As such, if you wish to retrieve these values you will need to do something like (Get-Sensor -Id 2258 | Get-ObjectProperty).InheritInterval
. Of course, unlike the other inheritance properties, InheritInterval
actually exists on Sensor
objects as well, so really you actually just need to do (Get-Sensor -Id 2258).InheritInterval
Regards, lordmilko
Excellent work - very useful. May have found a minor bug when scripting property changing via PowerShell. Before setting a property to a new value, I display the current property value. This works well apart from the InheritInterval property which returns an error when using get-objectproperty but works when using set-objectproperty.
Easy work arounds for my need as just setting the Interval property turns the Inheritance off.
Steps to reproduce
Below is the PowerShell commands to show the issue. Note - that the error has returned 'intervalgroup' as the property whereas the command property was 'InheritInterval' - could this be a typo in the code?
PS C:\Windows\system32> get-sensor -ID 2258 |get-objectproperty InheritInterval get-objectproperty : PRTG was unable to complete the request. A value for property 'intervalgroup' could not be found. At line:1 char:22
PS C:\Windows\system32> get-sensor -ID 2258 |set-objectproperty InheritInterval True PS C:\Windows\system32> get-sensor -ID 2258 |set-objectproperty InheritInterval False PS C:\Windows\system32> get-sensor -ID 2258 |set-objectproperty InheritInterval True PS C:\Windows\system32>
Additional context Anything else I should know to help solve the issue?