What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags

View all Tags

powershell - query terminate with unexpected error by send




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 = "$benutzer&passhash=$passwort"
$resulta = Invoke-RestMethod -Uri $uri -ContentType 'application/JSON'

--- end -------


Invoke-RestMethod : Die zugrunde liegende Verbindung wurde geschlossen: Für den geschützten SSL/TLS-Kanal konnte keine Vertrauensstellung hergestellt 

+ $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

connection powershell prtg-api

Created on Dec 30, 2020 2:24:44 PM

Last change on Dec 31, 2020 7:44:12 AM by  Sven Roggenhofer [Paessler Technical Support]

1 Reply



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:

add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

$result = Invoke-WebRequest -Uri "https://IpAddress/resource"

Source: https://stackoverflow.com/questions/11696944/powershell-v3-invoke-webrequest-https-error

Created on Dec 31, 2020 1:12:13 PM by  Moritz Heller [Paessler Support]

Last change on Dec 31, 2020 1:12:35 PM by  Moritz Heller [Paessler Support]

Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.