Closed kacoroski closed 2 years ago
So I check the html and I see:
but when I try a get property on devicetemplatecheck I get: PS C:\Users\Administrator> get-group -Id 3014 | Get-ObjectProperty -RawProperty devicetemplatecheck Get-ObjectProperty : PRTG was unable to complete the request. A value for property 'devicetemplate__check' could not be found. At line:1 char:22
+ CategoryInfo : InvalidOperation: (:) [Get-ObjectProperty], PrtgRequestException
+ FullyQualifiedErrorId : PrtgRequestException,PrtgAPI.PowerShell.Cmdlets.GetObjectProperty
$d = get-devicetemplate *rdp*
get-group servers|Set-ObjectProperty -RawParameters @{
discoverytype_=2
devicetemplate__check=$d
ipbase_="192.168.0"
devicetemplate_=1
} -force -verbose
If you already have the IP Base set you don't have to re-specify it, but when you first select to use device templates this value needs to be filled in
The secret property you were most likely missing is devicetemplate_=1
; often you need to signify "I am modifying this this value" when there's a number of options you can possibly select from. You can find the parameters required for any request by running Fiddler Classic and tracing the web request made when you edit the settings of an object
Get-ObjectProperty -RawProperty
asks PRTG for a given property directly. Not all properties can be queried directly; for them, you can view them by having PrtgAPI retrieve all properties (which it does by scraping the Settings page)
C:\> get-group servers|get-objectproperty -raw|select *devicetemplate*
devicetemplate devicetemplate__check
-------------- ---------------------
0 Server RDP.odt|RDP Server||
Thanks this works perfectly.
Thanks for your quick response and help.
Describe the bug
I am trying to change the device template on a group from Device Generic SNMP.odt to NSD-Switch.odt. I am using the Set-ObjectProperty -RawProperty command described in the wiki and cannot get it to work. Not sure what I am doing incorrectly.
Steps to reproduce
What is the output of 'Get-PrtgClient -Diagnostic'?
Additional context
Just wondering if it is even possible to set the device template on a group. From the wiki I see that it can be done when a sensor is created.