lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
301 stars 37 forks source link

Adding Ping sensor throws authentication error #270

Closed JasonV1 closed 2 years ago

JasonV1 commented 2 years ago

Describe the bug

Hi,

I had a perfectly working script until a few days ago where I would look through a CSV of information to automatically add a group, device and ping sensor automatically.

Now recently, without changing the script or my password, I can't add Ping sensors anymore... it gives me the following error.

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

As obvious as that sounds, a wrong password cannot be the issue. I've been using this script for weeks and it worked perfectly until now. And if the password is wrong, then why can I still add groups and devices?

Can anyone help me with this? We're about to move 2000 internet connections into my PRTG system so we need this script bad.

Steps to reproduce

Connect-PrtgServer -Server hidden.domain.name

Import-Csv -Path $PSScriptRoot\locations.csv | Foreach-Object {
    Write-Host "Adding $($_.DeviceName) with IP address $($_.IPAddr) to group $($_.Location) ($($_.Name))"
    Get-Group -Name $($_.Name) | Add-Group $($_.Location) | Add-Device $($_.DeviceName) $($_.IPAddr) | New-SensorParameters -rt Ping | Add-Sensor
}

Disconnect-PrtgServer

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

PSVersion      : 5.1.19041.1320
PSEdition      : Desktop
OS             : Microsoft Windows 10 Pro
PrtgAPIVersion : 0.9.16
Culture        : en-NL
CLRVersion     : 528372
PrtgVersion    : 22.1.74.1869
PrtgLanguage   : english.lng

Additional context

No response

badoqu commented 2 years ago

Hi, having the exact same problem.

lordmilko commented 2 years ago

Duplicate of #268