Closed tzihad1 closed 2 years ago
Hi @tzihad1,
Are you referring to setting the Windows/Linux/VMware, etc credentials of the device? If so this is done after the device has been created using the Set-ObjectProperty cmdlet
By using Add-Device
and Set-ObjectProperty
together, it should be possible to do whatever you want using the information contained in a CSV
Set-ObjectProperty Only gives you possibility to update Inheritance on credentilas, not give new creds. We are trying to add Cisco Meraki and snmp creds to new devices, all device has own unique password/api key.
Set-ObjectProperty
allows you to set any property on an object. Please see this list of SNMP related settings that are natively supported by the cmdlet. It sounds like you might be after -SNMPv3UserName
and -SNMPv3Password
Yes, I know about SNMP, but we are using PRTG's native "Cisco Meraki Network Health" sensor and another sensor that need's the API key is "FortiGate System Statistics"-sensor. Is is possible to implement these to API?
If you are trying to modify properties spcific to this sensor type you will need to specify the -RawProperty
/ -RawParameters
of the properties you're trying to modify
Please see the wiki for information on how to do this
Thank you, pointing to correct wiki page, I now can update all the needed data. The key was the underscore_ at the end of property name Get-device -id 7836 | Set-ObjectProperty -RawProperty paessler-fortigate-fortigate_credentials_section-portgroup-port -RawValue "10443"
One thing that I can't change is "top" level *-credentials_section to remove inheritance of credentials. example:"paessler-fortigate-fortigate_credentials_section" All the other elements change, but not that.
$device | Set-ObjectProperty -RawProperty paessler-fortigate-fortigate_credentialssection -RawValue 0 -force
Typically properties relating to inheritance do not end in an underscore. You can verify the correct name of each property by going Ctrl+Shift+J in chrome and selecting the input control with the selector.
It's also worth noting if you are modifying multiple properties it's faster to use -RawParameters
instead
$device | Set-ObjectProperty -RawParameters @{
first_ = 1
second_ = "test"
inheritfoo = 0
} -Force
Chrome gives
_input class="toggleFieldset GroupShowHide checkbox" name="paessler-fortigate-fortigate_credentials_section"
type="checkbox" value="1" id="Inheritpaessler-fortigate-fortigate_credentials_section" checked="checked"
style="display: none;"
neither name or id in powershell works, both fail.
PS C:\>**$device | get-ObjectProperty -raw**
- lists "paessler-fortigate-fortigate_credentials_section" and shows it's value,
_paessler-dellemc-dellemc_credentials_section-port_group-port : 443
paessler-fortigate-fortigate_credentials_section : 1
paessler-fortigate-fortigate_credentials_section-credentials_group-apitoken : *********_
but getting or setting property fails
PS C:\> **$device | get-ObjectProperty -RawProperty paessler-fortigate-fortigate_credentials_section**
get-ObjectProperty : PRTG was unable to complete the request. A value for property 'paessler-fortigate-fortigate_credentials_section' could not be found.
At line:1 char:11
+ $device | get-ObjectProperty -RawProperty paessler-fortigate-fortiga ...
PS C:\> **$device | get-ObjectProperty -RawProperty Inheritpaessler-fortigate-fortigate_credentials_section**
get-ObjectProperty : PRTG was unable to complete the request. A value for property 'Inheritpaessler-fortigate-fortigate_credentials_section' could not be found.
At line:1 char:11
+ $device | get-ObjectProperty -RawProperty Inheritpaessler-fortigate- ...
while work
PS C:\> **$device | get-ObjectProperty -RawProperty paessler-fortigate-fortigate_credentials_section-credentials_group-apitoken**
_*********_
PRTG typically does not allow querying inheritance related properties, hence why
$device | get-ObjectProperty -RawProperty paessler-fortigate-fortigate_credentials_section
does not work. Can you please provide the Set-ObjectProperty
code you are using that does not work. Based on what I've seen I believe you should be able to achieve this as follows
$device | Set-ObjectProperty -RawParameters @{
"paessler-fortigate-fortigate_credentials_section-credentials_group-apitoken_" = "foo"
"paessler-fortigate-fortigate_credentials_section" = 0
} -Force
Hi,
Thank you, This works
$device | Set-ObjectProperty -RawParameters @{
"paessler-fortigate-fortigate_credentials_section-credentials_group-apitoken_" = "foo"
"paessler-fortigate-fortigate_credentials_section" = 0
} -Force
While creating new device with PrtgAPi, it would be good to be apple to give device specific credentials. Adding multiple machines from csv, including credentials, isn't possible currently.