Closed xasz closed 2 years ago
Hi @xasz,
It looks like these settings can only be changed after the object has been created; therefore the cmdlets you are looking for are Get-ObjectProperty
and Set-ObjectProperty
respectively
C:\ Get-Sensor -Id 2061 | Get-ObjectProperty -Raw
name : Disk Free (Paused Sensor)
parenttags : C_OS_VMware TestGroup TestProbe
tags : diskspacesensor wmidiskspacesensor
limitpercent : 0
upperlimiterrorpct :
upperlimitwarningpct :
lowerlimitwarningpct :
lowerlimiterrorpct :
limitbytes : 0
upperlimiterrorbyte :
upperlimiterrorbyte__factor : 9.5367431640625E-7
upperlimitwarningbyte :
upperlimitwarningbyte__factor : 9.5367431640625E-7
lowerlimitwarningbyte :
lowerlimitwarningbyte__factor : 9.5367431640625E-7
lowerlimiterrorbyte :
lowerlimiterrorbyte__factor : 9.5367431640625E-7
erroronmissingdisk : 0
writeresult : 0
stack : 0
...
To modify these properties you'll need to construct a request specifying all of the required raw parameters
C:\ Get-Sensor -Id 2061 | Set-ObjectProperty -RawParameters @{
limitpercent_ = 1
upperlimiterrorpct_ = 30
} -Force
Don't forget to add the trailing underscore to each property name!
Note that if you wish to modify the byte limit of the sensor rather than percent you'll need to specify the factor as well (might be easiest to store the output of Get-ObjectProperty -Raw
in a variable and pull the relevant factors from the variable rather than hard coding any particular value)
For more information please see the wiki
Regards, lordmilko
Thank your lordmilko - that helped alot.
For anyone who exactly does need this, this works fine for me and as far as i have seen have not caused any trouble:
$param = $prtgDevice | New-SensorParameters -RawType wmidiskspace
$param.Name = $SensorName
# some more settings
$prtgDevice | Add-Sensor $param | Set-ObjectProperty -RawParameters @{lowerlimitwarningpct_ = 15; lowerlimiterrorpct_ = 15} -Force
What's going on?
Hello lordmilko,
i am trying to get / set the default limits of an wmidiskspace settings which are listed on the settings tab on the prtg: I have checked the
New-SensorParameters
:Checked with the
Get-Object
on the sensor:Checked with the
Get-Sensor
on the sensor:But i could not figure out if or how i could change these values. I appreciate any help or hint and thank you again for your nice work.
Due Dilligance