Hi
If i take my demo script, with support of prtg query builder, i got a error with unexpected by send i startet this demo script directly on my server. i started Windows Powsershell ISE with run as Aministrator Rights
--- start ---- $benutzer = "hans.mustermann" $passwort = "123456789" $uri = "http://127.0.0.1/api/table.json?content=sensors&columns=sensor&username=$benutzer&passhash=$passwort" $resulta = Invoke-RestMethod -Uri $uri -ContentType 'application/JSON' $resulta --- end -------
Erromessage
Invoke-RestMethod : Die zugrunde liegende Verbindung wurde geschlossen: Für den geschützten SSL/TLS-Kanal konnte keine Vertrauensstellung hergestellt werden.. + $resulta = Invoke-RestMethod -Uri $uri -ContentType 'application/JSON ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
If i try to use the command for [ServerCertificateValidationCallback]::ignore(); its not working too
Do you have any clue, how can i easy to view - in the first step to view all data over prtg api. I dont want to use install-module prtg e.g.
Please advise
Thanks
Jochen
Hi there,
Did you already tried to switch PRTG to HTTP and not HTTPS for troubleshooting? You can also try to use "Invoke-Webrequest" instead of "Invoke-RestMethod" with the follwing addition to ignore the certificate validation:
Source: https://stackoverflow.com/questions/11696944/powershell-v3-invoke-webrequest-https-error
Dec, 2020 - Permalink