lordmilko / PrtgAPI

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

Adding new sensors not working after update to version 23.3.86.1520 #345

Closed imaderaya closed 1 year ago

imaderaya commented 1 year ago

Describe the bug

Hello,

After updating PRTG to version 23.3.86.1520, Adding sensors is not working any more. The error message : Could not authenticate to PRTG; the specified username and password were invalid

Steps to reproduce

Code Example:

Connect-PrtgServer -Server "https://prtgserver.com" (New-Credential "username" "passwd");
$device = Get-Device -Id 126556;
$device | New-SensorParameters -RawType ping | Add-Sensor

Result:

Add-Sensor : Could not authenticate to PRTG; the specified username and password were invalid.

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

PSVersion      : 5.1.20348.1850
PSEdition      : Desktop
OS             : Microsoft Windows Server 2022 Standard
PrtgAPIVersion : 0.9.18
Culture        : fr-CH
CLRVersion     : 528449
PrtgVersion    : 23.3.86.1520
PrtgLanguage   : english.lng

Additional context

There is no issue with:

lordmilko commented 1 year ago

Hi @imaderaya,

I have deployed a fix for this issue. Can you please follow the manual installation instructions and advise whether this issue is resolved in PrtgAPI 0.9.19-preview.2?

imaderaya commented 1 year ago

Hi @lordmilko,

I confirm that the issue is resolved in PrtgAPI 0.9.19-preview.2.

Great job.

TheUdK commented 1 year ago

Any chance of building a release and publishing to PSGallery as release or prerelease?

schoenm1 commented 1 year ago

Hi @lordmilko,

I confirm that the issue is resolved in PrtgAPI 0.9.19-preview.2.

Great job.

Same here. After installing current Prelease, my Scripts are working again.

MikeyMing commented 1 year ago

I still get the issue with the latest version.

Add-Sensor : Could not authenticate to PRTG; the specified username and password were invalid. At line:14 char:34

get-command add-sensor

CommandType Name Version Source


Cmdlet Add-Sensor 0.9.18 PrtgAPI

MikeyMing commented 1 year ago

Get-PrtgClient -Diagnostic

PSVersion : 5.1.14393.5582 PSEdition : Desktop OS : Microsoft Windows Server 2016 Standard PrtgAPIVersion : 0.9.18 Culture : da-DK CLRVersion : .NET Framework 4.8 (528049) PrtgVersion : 23.3.86.1520 PrtgLanguage : english.lng

xasz commented 1 year ago

@MikeyMing not sure if you are using the Preview. I have not tested the preview - I need to, but had no time - So my prtg upgrade to the newest version will have to wait. But your version sys 0.9.18 and not 0.9.19-preview.2

MikeyMing commented 1 year ago

How do I get the preview? When I click on the link it downloads the latest zip directly.

Thanks

lordmilko commented 1 year ago

You need to follow the manual installation instructions to use the latest preview build, however I am actively in the process of trying to release PrtgAPI 0.9.19, I'm just trying to resolve some issues with my build system

lordmilko commented 1 year ago

Please be advised PrtgAPI 0.9.19 has now been released. Please do Update-Module PrtgAPI and then reopen your PowerShell session

MikeyMing commented 1 year ago

Thanks. Its working now. God bless PrtgAPI

MikeSouthwell commented 12 months ago

Hi LordMilko,

I have updated to 0.9.19, but I am still getting the same error.

Can you please take another look?

PSVersion : 5.1.17763.4974 PSEdition : Desktop OS : Microsoft Windows Server 2019 Datacenter PrtgAPIVersion : 0.9.19 Culture : en-AU CLRVersion : .NET Framework 4.8 (528049) PrtgVersion : 23.3.88.1421 PrtgLanguage : english.lng

Set-ObjectProperty : PRTG was unable to complete the request. The server responded with the following error: The validation of the data you entered has failed. Authorization: Required field, not defined. The object has not been changed.

lordmilko commented 12 months ago

Can you please provide a code sample which is generating this error?

MikeSouthwell commented 12 months ago

Please see relevant code snippet below that is causing that error:

Get-Sensor -Name "Template" -count 1 | Clone-Object -DestinationId $resellerID.Id -Name $backupSensorName -Resume

Get-Sensor -Name $backupSensorName | Set-ObjectProperty -RawProperty paessler-microsoft365-mailbox_section-mailbox_group-filter_subject_string_ -RawValue "$subjectString" -Force

carsten0407 commented 11 months ago

Where can I download the PrtgAPI 0.9.19-preview.2? the manuial download lis broken

https://ci.appveyor.com/api/projects/lordmilko/prtgapi/artifacts/PrtgAPI.zip {"message":"Artifact not found or access denied."}

lordmilko commented 11 months ago

PrtgAPI 0.9.19 has now been released

To update PrtgAPI, please run Update-Module PrtgAPI in PowerShell and then close and reopen the window

carsten0407 commented 11 months ago

Yessss, it works, thx