lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
305 stars 38 forks source link

Missing Property for 'SNMPv3EncryptionType' and 'SNMPv3AuthType' #342

Closed schoenm1 closed 3 months ago

schoenm1 commented 1 year ago

Describe the bug

Not all Values for 'SNMPv3EncryptionType' and 'SNMPv3AuthType' are available in PRTGAPi PowerShell Module.

If e.g. AES 192 is chosen in GUI, the PRTGAPI Module shown an error. image

PS C:\Users\name> $dev | Get-ObjectSetting SNMPv3EncryptionType
Get-ObjectSetting : Could not deserialize value 'AES192PrivProtocol' as it is not a valid member of type 'PrtgAPI.EncryptionType'. Could not process XML '<snmpv3encryptiontype />'.
At line:1 char:8
+ $dev | Get-ObjectSetting SNMPv3EncryptionType
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ObjectProperty], XmlDeserializationException
    + FullyQualifiedErrorId : PrtgAPI.XmlDeserializationException,PrtgAPI.PowerShell.Cmdlets.GetObjectProperty

Could it be, that this is related to changes in PRTG 'May 24th 2023 - Version 23.2.84.1566' image

Steps to reproduce

Set in GUI in SNMPv3 "Authentication Method" to 'AES-192'

Save
Go to PowerShell Module

PS C:\Users\name> $dev | Get-ObjectSetting SNMPv3EncryptionType
Get-ObjectSetting : Could not deserialize value 'AES192PrivProtocol' as it is not a valid member of type 'PrtgAPI.EncryptionType'. Could not process XML '<snmpv3encryptiontype />'.
At line:1 char:8
+ $dev | Get-ObjectSetting SNMPv3EncryptionType
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ObjectProperty], XmlDeserializationException
    + FullyQualifiedErrorId : PrtgAPI.XmlDeserializationException,PrtgAPI.PowerShell.Cmdlets.GetObjectProperty

Set in GUI in SNMPv3 "Authentication Method" to 'AES'

PS C:\Users\name> $dev | Get-ObjectSetting SNMPv3EncryptionType AES

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

PSVersion      : 5.1.19041.2673
PSEdition      : Desktop
OS             : Microsoft Windows 10 Enterprise
PrtgAPIVersion : 0.9.18
Culture        : de-CH
CLRVersion     : 528372
PrtgVersion    : 23.2.84.1566
PrtgLanguage   : english.lng

Additional context

No response

noaboa97 commented 1 year ago

Hi :) I investigated this a little and I think it's because the Enum doesn't have the new values, that PRTG added. And because this feature was just recently added to PRTG.

The new values would need to be added here: src/PrtgAPI/Enums/Deserialization/ObjectSettings/EncryptionType.cs Currently only DES and AES are supported by prtgAPI.