lordmilko / PrtgAPI

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

Question : DTD error when calling Get-Probe / Get-Device etc #216

Closed KoalaScripts closed 3 years ago

KoalaScripts commented 3 years ago

Dear ,

Its my first time using the Module in Powershell but i can't seem to get it working. I can make a connection to my PRTG server but once i try retrieving something it returns following error :

Get-Probe : For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method. At line:6 char:1

After a lot of searching i can only seem to bump on possible DNS issues. Would you be able to point me in the right direction into solving this issue?

Thank you in advance !

lordmilko commented 3 years ago

Hi @KoalaScripts,

Are you able to advise whether other cmdlets like Get-Device work? Nevermind, I see you mentioned Get-Device in the title

Are you able to provide the output of Get-PrtgClient -Diagnostic?

In addition, can you post the output of the following

Set-PrtgClient -LogLevel Response

Get-Device -Verbose

Regards, lordmilko

KoalaScripts commented 3 years ago

Hello @lordmilko ,

I get the same error for Get-Device & Get-Probe . When i run the command Get-PrtgClient - Diagnostic i get the following :

Get-PrtgClient -Diagnostic Get-PrtgClient : There was an error deserializing the object of type PrtgAPI.ServerStatus. Encountered unexpected character '<'. At line:1 char:1

lordmilko commented 3 years ago

Hi @KoalaScripts,

Interesting; are you able to advise what version of PRTG you use?

KoalaScripts commented 3 years ago

Hello @lordmilko

Our version at the moment is : 21.1.66.1664+

The added verbose returned following :

VERBOSE: Get-Device: <!doctype html>
<html class="">
<!--
 _____  _______ _______ _______ _______        _______  ______
|_____] |_____| |______ |______ |______ |      |______ |_____/
|       |     | |______ ______| ______| |_____ |______ |    \_

We are hiring! https://jobs.paessler.com

-->
<head>
  <link rel="manifest" href="/public/manifest.json.htm">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta name="robots" content="noindex, follow">
  <meta name='viewport' content='width=device-width, height=device-height, initial-scale=0.8'>
  <link id="prtgfavicon" rel="shortcut icon" type="image/ico" href="/favicon.ico" />
  <title>Welcome | PRTG</title>
  <link rel="stylesheet" type="text/css" href="/css/prtgmini.css?prtgversion=__" media="print,screen,projection" />

</head>
<body id="mainbody" class="systemmenu loginscreen language_en">
<!--
//        You can use this file to modify the appearance of the PRTG web interface
//        as described in https://kb.paessler.com/en/topic/33
//        
//        Please note that you are using an unsupported and deprecated feature. 
//        Your changes will be broken or removed with future PRTG updates.
//        
//        If you modify this file, PLEASE LET US KNOW what you're changing and why!
//        Just drop an email to support@paessler.com and help us understand your 
//        needs. Thank you!       
-->

<style>
  .browsercheck.container{display:none;}
</style>
<div id="login-container">

  <div class="login-form" style="">
    <div class="login-cell box">
            <div class="cell-left cell-login">
            <h1>PRTG</h1>
            <noscript>
              <div style="margin-bottom:10px">
                <div class="nagscreen-box" >
                  <p class="nagscreen-head">JavaScript is not available!</p>
                  <p class="nagscreen-cell">
                    You cannot use the Ajax web interface without JavaScript. <br>JavaScript is either disabled or not supported by your browser.
                  </p>
                </div>
              </div>
            </noscript>
            <div id="notofficiallysupported" style="display:none" class="nagscreen-box">
              <p class="nagscreen-head">
                Your browser is not officially supported.
              </p>
              <p class="nagscreen-cell">
                Some functionalities may not work correctly or may not work at all. Consider upgrading to a supported browser version. We recommend <a href='https://www.google.com/chrome/'>Chrome</a> or <a href='http://www.mozilla.org/firefox/'>Firefox</a>.
              </p>
            </div>
            <div id="unsupportedbrowser" style="display:none;">
              <div class="nagscreen-box" >
                <p class="nagscreen-head">
                 Sorry, your browser is not supported.
                </p>
                <p class="nagscreen-cell">
                  <b>You might not be able to access all PRTG features with this browser.</b><br>
                  Please upgrade to a supported browser version. We recommend <a href='https://www.google.com/chrome/'>Chrome</a> or <a href='http://www.mozilla.org/firefox/'>Firefox</a>.
                </p>
              </div>
            </div>
            <div id="dontuselocalhost" style="display:none;">
              <div class="nagscreen-box" >
                <p class="nagscreen-head">
                  Please do not use http://localhost to access the PRTG web server!
                </p>
                <p class="nagscreen-cell">
                  This may considerably slow down the PRTG web interface on some browsers. Use your IP or DNS name instead.
                </p>
              </div>
            </div>
            <form id="loginform" class="loginform" accept-charset="UTF-8" action="/public/checklogin.htm" method="post" >
                    <input id="hiddenloginurl" type="hidden" name="loginurl" value="">
                <p class="login-error"><div class="errormessage"></div></p>
                <div class="controlgroup">
                <label for="loginusername">Login&nbsp;Name</label>
                <input tabindex="1" autofocus class="text" id="loginusername" name="username" type="text" value=""  />
                </div>

                <div class="controlgroup">
                <label for="loginpassword">Password</label>
                <input tabindex="1" class="text" id="loginpassword" name="password" type="password" value=""  />
                </div>
                <p class="buttonbar">
                    <button class="loginbutton button big" type="submit">Login</button>
                </p>
            </form>
                <span class="downloadclients">
                    <a class="nohjax" href="/downloads.htm">Download apps for Windows, macOS, iOS, Android (optional)</a>
                </span>

                <span class="forgotpw">
                    <a class="nohjax" href="/public/password_request.htm">Forgot password?</a>

                    <a target="_blank" href="/help/login.htm#login">Need help?</a>
                </span>
            </div>
          <div class="cell-left cell-news" style="">
            <div class="logo-box">
            <img class="prtg-logo-big" width="250" height="150" src="/images/prtg_logo_gray.png" />
            </div>
            <div class="newsfeed"><h2>Paessler Blog</h2><div class="newsfeed-content">
<div><h3><a target="_blank" href="https://blog.paessler.com/cyberattack-on-water-utility-shows-vulnerability-of-industrial-networks">Cyberattack on water plant shows vulnerability of industrial networks</a></h3><p>The attack on a water company in Oldsmar, Fl
orida, is an almost textbook illustration of the security flaws that still prevail in many critical infrastructures. The lack of damage from the attack was a lucky coincidence rather than due to a thorough security concept. The incident underscores the need 
for intelligent, real-time monitoring in critical infrastructure.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/why-monitor-unified-communications-quality">Why monitor Unified Communications quality?</a></h3><p>VQM (voice/video quality monitoring) is an advanced monitoring methodology used to mitigate and res
olve performance-affecting issues before they become catastrophic. VQM works by leveraging both active (synthetic) and passive (live call/session) testing and analysis. With typical premise-based Unified Communications (UC) implementations, voice and video c
onferencing application traffic travels over the organizations existing LAN/WAN infrastructure.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/protocols-gateways-data-transmission-building-state-monitoring-1/2">Protocols, gateways and data transmission methods for building state monitoring | Part 1/2</a></h3><p>This article is part 1/2 abo
ut the protocols, gateways, and data transmission methods (as well as wireless protocols) relevant in building state monitoring. But let's first start with the philosophy behind it all, which is mainly based on manufacturer independence and open systems.</p>
</div>
<div><h3><a target="_blank" href="https://blog.paessler.com/monitor-all-aspects-of-a-data-center-with-prtg">Monitor all aspects of a data center with PRTG</a></h3><p>It doesn't matter whether it's in the cloud, a hybrid solution or on-premises: Ultimately, I
T takes place on physical computers in a building - the data center. In order to ensure excellent performance and trouble-free operation of a data center, it is essential to keep a constant eye on a whole range of different components, both in IT and in faci
lities, in order to detect flaws as early as possible and thus avoid problems, damage and breakdowns:</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/prtg-21.1.66-is-about-opcua-and-existing-sensor-improvements">PRTG 21.1.66 is about OPC UA and improvements to existing sensors</a></h3><p>Time for another new release of PRTG Network Monitor. Our l
atest PRTG version, 21.1.66, is ready for installation and is packed with several new features. That said, have you tried all the new sensors we introduced you to with the previous PRTG versions? For example, the new Veeam Backup Job Status Advanced sensor o
r the Microsoft Azure Subscription Cost sensor? No? Then be sure to check them out, just in case there are no new sensors for your environment in this release. Because the new sensor types I'll introduce today are all about Industrial IT. With our two new OP
C UA sensor types we deliver two real heavyweights when it comes to communicating with machines on your shop floor.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/cloudrail-knowledge-is-power-for-industrial-retrofitting">CloudRail - Knowledge is power for industrial retrofitting</a></h3><p>Whether you call it Industry 4.0, IIoT or Smart Manufacturing, the obj
ective behind these trendy buzzwords is the same - to “connect all the things”. Whether you're responsible for a segment of critical national infrastructure, production lines in a thingamabob factory or a small family run farm; instrumenting and collecting d
ata from your production environment can transform your business in terms of efficiency, cost savings and profitability. As Sir Francis Bacon (among others) observed “scientia potential est” or “knowledge is power”.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/increase-the-security-of-your-data-center-with-prtg">Increase the security of your data center with PRTG</a></h3><p>If you ask an IT administrator or an IT manager which room is the most important i
n the company, the answer is usually clear - the server room or the data center. This is the central IT node, which must be protected by security measures and monitored like no other room. This article is about physical security of data centers, how you can 
improve it with PRTG and how to simultaneously reduce the consumption of resources.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/all-lpwan-players-in-one-short-overview">All LPWAN players in one short overview</a></h3><p>LoRa, Sigfox, MIOTY, and NB IoT (or LTE-M), so many names, so many LPWAN players, so many ways of connecti
ng devices fast, reliably, and cost-effectively. There's an increasing demand for connecting simple devices such as sensors and actuators with as little energy consumption and the greatest coverage possible. Although LPWAN (low-power wide-area networking) is
 just one of several transmission technologies in the IoT (Internet of things) field, it is becoming increasingly important, for the private and the commercial sector, like industrial processes (IIoT), fully connected buildings (building state monitoring), a
nd projects in the context of Smart City, Smart Agriculture, and Environmental monitoring. Specific requirements for building state monitoring that go beyond LPWAN will be covered in a separate blog article soon.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/monitor-your-entire-dell-infrastructure-with-prtg">Monitor your entire Dell infrastructure with PRTG</a></h3><p>Dell server and storage systems are not only used in corporate data centers, but also 
by cloud providers who provide their customers with various services such as IaaS, PaaS or SaaS. Ensuring that all systems function smoothly is a decisive criterion here. Disruptions or even failures can quickly result in financial losses. In this post, I'll
 explain how you can use PRTG Network Monitor to monitor your entire Dell infrastructure, and thus ensure continuity. By using the appropriate sensors, you will never lose the overview and you will always be informed about the status of the systems.</p></div
>
<div><h3><a target="_blank" href="https://blog.paessler.com/prtg-has-embedded-sensor-types-to-monitor-microsoft-azure">PRTG has embedded sensor types to monitor Microsoft Azure</a></h3><p>Do you still have a classic server infrastructure at your company? Wit
h a stuffed server room and all data and applications on premises? I suspect not. Because cloud services that are affordable, easily configured and accessible from everywhere have finally arrived, and I'm sure at least some of your data infrastructure is alr
eady cloud-based. Which means you've surely come into contact with Amazon Web Services, the Google Cloud Platform or Microsoft Azure. Or all three.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/get-more-insights-into-your-veeam-backup-jobs-with-prtg">Get more insights into your Veeam backup jobs with PRTG</a></h3><p>As of version 20.4.64, PRTG Network Monitor can get more insights into you
r Veeam backup jobs. By using two native sensors, Veeam Backup Job Status and Veeam Backup Job Status Advanced (BETA), you can monitor the total number of backup jobs in the last 24 hours and get detailed information for specific backup jobs. Both sensors su
pport IPv4 and IPv6 and they have a very low performance impact. You need to be running Veeam Backup Enterprise Manager and the Enterprise Plus edition of Veeam Backup &amp; Replication. This article explains three easy steps to start monitoring your Veeam b
ackup jobs.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/monitor-digital-business-services-with-paessler-prtg-enterprise-monitor">Monitor digital business services with Paessler PRTG Enterprise Monitor</a></h3><p>In this article, I will show you how you c
an monitor digital business processes using Paessler PRTG Enterprise Monitor. Basically, IT systems are always involved as part of a digital business process. On the one hand, there are servers and network distributors, in other words the infrastructure, and
 on the other hand the applications, for example: database management systems, programs or protocols. For the user, it is important to know if a certain service or process is running from an end-user perspective, like a web shop or a CRM system. In most case
s, the user is not interested in the granular details of the application and infrastructure layer.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/deep-packet-inspection-approaches-to-ot-network-security">Deep Packet Inspection approaches to OT network security</a></h3><p>In a recent article, I wrote about how cybersecurity is one of the top c
hallenges that industrial IT faces over the next few years. Aside from the exponential rise in cyberattacks, such as DoS, ransomware and trojan attacks, IT/OT convergence places industrial IT networks at more risk than in the past.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/storage-capacity-planning-with-prtg">Storage capacity planning with PRTG</a></h3><p>Spending on storage is usually done much too reactively. Some companies end up buying storage capacity at the last
 minute, which is unwise. A good storage capacity planning tool helps to make sure that just enough storage is purchased to meet the needs of users and applications. PRTG Network Monitor helps to estimate the utilized capacity and helps to better understand 
capacity needs for the future. You get automated reports on individual storage utilization, so you can plan your storage expenditures wisely. This is part of a blog series about storage. Check out the first part on storage performance monitoring.</p></div>
<div><h3><a target="_blank" href="https://blog.paessler.com/a-packet-too-far-passive-monitoring-for-ot-networks">A packet too far: Passive monitoring for OT networks</a></h3><p>One of the big differentiators between the worlds of IT and OT is their attitude 
to “active” network tools – those that actually place traffic “onto the wire”. In all but the most sensitive IT networks, this is almost never an issue. The typical IT network is literally awash with different protocols – DNS, DHCP, SMTP, HTTP; the list goes
 on. In a large, complex IT environment there could be literally dozens of different protocols flying about. So, introducing a new system, such as a network monitoring tool – PRTG for instance – with its reliance on SNMP, WMI and other protocols, is seldom a
 big issue.</p></div>
</div></div>

        </div>
        <div class="cell-left cell-banner">

            <div></div>
            </div>
    </div>
  </div>

  <div class="footer">
        <span class="paesslerlogo">
      <a href="https://www.paessler.com?utm_source=prtg&utm_medium=referral&utm_campaign=webgui-homepage" target="_blank" title="Paessler AG - The Network Monitoring Company"><img border=0 id="paesslerlogo" src="/images/paessler.png"></a>
    </span>
    <span class="prtgversion">&nbsp;PRTG Network Monitor  </span>
    <span class="copyright">&copy; 2021 <a href="https://www.paessler.com?utm_source=prtg&utm_medium=referral&utm_campaign=webgui-homepage" target="_blank" title="The Network Monitoring Company">Paessler AG</a></span>
  </div>
</div>
<script>
  var actualBrowserInclude = {
    "current": {
        "desktop": {
            "c": 72,
            "e": 18,
            "f": 65,
            "i": 11,
            "ios": 10.3,
            "o": 57,
            "s": 12,
            "vivaldi": 1.8
        },
        "mobile": {
            "android": 0,
            "c": 71,
            "f": 64,
            "o": 46
        }
    }
}
// prebuild action on bmx
// this file should be downloaded and updated from
// https://github.com/browser-update/browser-update/browser.json
;
  (function(window, document, undefined){
//(c)2017, MIT Style License <browser-update.org/LICENSE.txt>
//https://github.com/browser-update/browser-update/blob/master/update.js
//unmodified
if (window.nocheck) {
    return
}
function $bu_getBrowser(ua_str) {
    var n,t,ua=ua_str||navigator.userAgent,donotnotify=false;
    var names={i:'Internet Explorer',e:"Edge",f:'Firefox',o:'Opera',s:'Safari',n:'Netscape',c:"Chrome",a:"Android Browser", y:"Yandex Browser",v:"Vivaldi",uc:"UC Browser",x:"Other"};
    function ignore(reason,pattern){if (RegExp(pattern,"i").test(ua)) return reason;}
    var ig=ignore("bot","bot|spider|archiver|transcoder|crawl|checker|monitoring|screenshot|python-|php|uptime|validator|fetcher|facebook|slurp|google|yahoo|microsoft|node|mail.ru|github|cloudflare|addthis|thumb|proxy|feed|fetch|favicon|link|http|scrape|seo|
page|search console|AOLBuild|Teoma|Gecko Expeditor")||
        ignore("discontinued browser","camino|flot|k-meleon|fennec|galeon|chromeframe|coolnovo") ||
        ignore("complicated device browser","SMART-TV|SmartTV") ||
        ignore("niche browser","Dorado|Whale|SamsungBrowser|MIDP|wii|Puffin|Opera Mini|maxthon|maxton|dolfin|dolphin|seamonkey|opera mini|netfront|moblin|maemo|arora|kazehakase|epiphany|konqueror|rekonq|symbian|webos|PaleMoon|QupZilla|Otter|Midori|qutebrowse
r") ||
        ignore("mobile without upgrade path or landing page","kindle|silk|blackberry|bb10|RIM|PlayBook|meego|nokia|ucweb|ZuneWP7|537.85.10") ||
        ignore("android(chrome) web view","; wv");
    var mobile=(/iphone|ipod|ipad|android|mobile|phone|ios|iemobile/i.test(ua));
    if (ig)
        return {n:"x",v:0,t:"other browser",donotnotify:ig};

    var pats=[
        ["CriOS.VV","c"],
        ["FxiOS.VV","f"],
        ["Trident.*rv:VV","i"],
        ["Trident.VV","io"],
        ["UCBrowser.VV","uc"],
        ["MSIE.VV","i"],
        ["Edge.VV","e"],
        ["Vivaldi.VV","v"],
        ["OPR.VV","o"],
        ["YaBrowser.VV","y"],
        ["Chrome.VV","c"],
        ["Firefox.VV","f"],
        ["Version.VV.*Safari","s"],
        ["Safari.VV","so"],
        ["Opera.*Version.VV","o"],
        ["Opera.VV","o"],
        ["Netscape.VV","n"]
    ];
    for (var i=0; i <pats.length; i++) {
        if (ua.match(new RegExp(pats[i][0].replace("VV","(\\d+\\.?\\d+)"),"i"))) {
            n=pats[i][1];
            break;
        }
    }

    var semver=n==="v"||n==="y"||n==="uc";
    if (semver) {//zero pad semver for easy comparing
        var parts = (RegExp.$1).split('.');
        var v=(parts[0] + "." + ("00".substring(0, 2 - parts[1].length) + parts[1]));
    }
    else {
        var v=Math.round(parseFloat(RegExp.$1)*10)/10;
    }

    if (!n)
        return {n:"x",v:0,t:(names[n]||"unknown"),mobile:mobile};

    //do not notify old systems since there is no up-to-date browser available
    if (/windows.nt.5.0|windows.nt.4.0|windows.95|windows.98|os x 10.2|os x 10.3|os x 10.4|os x 10.5|os x 10.6|os x 10.7/i.test(ua))
        donotnotify="oldOS";

    //iOS
    if (/iphone|ipod|ipad|ios/i.test(ua)) {
        ua.replace("_",".").match(new RegExp("OS.(\\d+\\.?\\d?)","i"));//
        n="iOS";
        v=parseFloat(RegExp.$1);
        var h = Math.max(window.screen.height, window.screen.width);
        if (h<=480 || window.devicePixelRatio<2) //iphone <5 and old iPads  // (h>568 -->iphone 6+)
              return {n:"s",v:v,t:"iOS "+v,donotnotify:"iOS without upgrade path",mobile:mobile};
        return {n:"s",v:v,t:"iOS "+v,donotnotify:false,mobile:mobile};//identify as safari
    }

    //check for android stock browser
    if (ua.indexOf('Android')>-1 && n==="s") {
        var ver=parseInt((/WebKit\/([0-9]+)/i.exec(ua) || 0)[1],10) || 2000;
        if (ver <= 534)
            return {n:"a",v:ver,t:names["a"],mob:true,donotnotify:donotnotify,mobile:mobile};
        //else
        //    return {n:n,v:v,t:names[n]+" "+v,donotnotify:"mobile on android",mobile:mobile};
    }

    //do not notify firefox ESR
    if (n=="f" && (Math.round(v)==60 || Math.round(v)==68))
        donotnotify="ESR";

    if (n=="so") {
        v=4.0;
        n="s";
    }
    if (n=="i" && v==7 && window.XDomainRequest) {
        v=8;
    }
    if (n=="io") {
        n="i";
        if (v>6) v=11;
        else if (v>5) v=10;
        else if (v>4) v=9;
        else if (v>3.1) v=8;
        else if (v>3) v=7;
        else v=9;
    }
    if (n=="e") {
        return {n:"i",v:v,t:(names[n]||"unknown")+" "+v,donotnotify:donotnotify,mobile:mobile};
    }
    return {n:n,v:v,t:(names[n]||"unknown")+" "+v,donotnotify:donotnotify,mobile:mobile};
    }

  //(c)2017, MIT Style License <browser-update.org/LICENSE.txt>
//https://github.com/browser-update/browser-update/blob/master/update.js
//
  $buo = function(op, test) {
    var jsv = 24;
    var n = window.navigator;
    var b;
    var vsdefault = { i: 11, f: -4, o: -4, s: -2, n: 12, c: -4, a: 534, y: -1, v: -0.2 };
    var vsmin = { i: 11, f: 10, o: 20, s: 7, n: 12, c: 33};
    var vs = {x: 9999999};
    var akt = actualBrowserInclude;
    var vsakt = {};
    var ls = !!localStorage && localStorage.getItem("browsercheck");

    if(ls !== null){
      if(ls === "false")
        return;
      else if(typeof(ls) === "string"){
        try{
          ls = JSON.parse(ls);
        }catch(e){
          ls = false;
        }
      }
      if(ls !== false && !!ls.l && !!ls.b){
        if (ls.b.donotnotify) return;
        window.isunsupportedbrowser = true;
        $bu_show(ls.l,ls.b);
        return;
      }
    }
    akt = akt.current.desktop;
    this.op = op || {};

      vsakt["c"] = akt["c"];
      vsakt["f"] = akt["f"];
      vsakt["i"] = akt["i"];
      vsakt["o"] = akt["o"];
      vsakt["s"] = akt["s"];
      vsakt["e"] = akt["e"];

    for (b in vsdefault) {
      if (!vs[b]) vs[b] = vsdefault[b];
      if (vsakt[b] && vs[b] >= vsakt[b]) vs[b] = vsakt[b] - 0.2;
      if (vsakt[b] && vs[b] <0) vs[b] = vsakt[b] + vs[b];
      if (vsmin[b] && vs[b] <vsmin[b]) vs[b] = vsmin[b];
    }

    this.op.onshow = op.onshow || function(o) {};
    this.op.onclick = op.onclick || function(o) {};
    this.op.onclose = op.onclose || function(o) {};

    var bb = $bu_getBrowser(test);
    if (!bb
      || !bb.n
      || (document.cookie.indexOf("browserupdateorg=pause") > -1 && this.op.reminder > 0)
      || bb.v >= vs[bb.n]
      || (bb.mobile && op.mobile === false)
     ){
             //!!test && !!console && console.log("Browser OK", bb, vs)
            return;
    } else {
      if (bb.donotnotify == 'ESR') return;
    }

    if (this.op.nomessage) {
      op.onshow(this.op);
      return;
    }
    var ll = op.l || (n.languages ? n.languages[0] : null) || n.language || n.browserLanguage || n.userLanguage || document.documentElement.getAttribute("lang") || "en";
    ll = ll.replace("_","-").toLowerCase().substr(0,2);
    window.isunsupportedbrowser = true;
    $bu_show(ll, bb)

  };

  function $bu_show(ll,bb){
    var t = {};
    t.en = '<b>Your web browser (%s) is out of date</b>. For more security, comfort and the best experience on this site: <a%s>Update your browser</a> <a%s>Ignore</a>';
    t.de = '<b>Ihr Browser (%s) ist veraltet</b>. Aktualisieren sie ihren Browser für mehr Sicherheit, Komfort und die einwandfreie Nutzung dieser Webseite. <a%s>Browser aktualisieren</a> <a%s>Ignorieren</a>';
    t.it = '<b>Il tuo browser (%s) non è aggiornato</b>. Ha delle falle di sicurezza e potrebbe non visualizzare correttamente le pagine di questo e altri siti. <a%s>Actualice su navegador</a> <a%s>Chiudi</a>';
    t.pl = 'Przeglądarka (%s), której używasz, jest przestarzała. Posiada ona udokumentowane <b>luki bezpieczeństwa, inne wady</b> oraz <b>ograniczoną funkcjonalność</b>. Tracisz możliwość skorzystania z pełni możliwości oferowanych przez niektóre strony int
ernetowe. <a%s>Dowiedz się jak zaktualizować swoją przeglądarkę</a>.';
    t.es = '<b>Su navegador (%s) no está actualizado</b>. Tiene fallos de seguridad conocidos y podría no mostrar todas las características de este y otros sitios web. <a%s>Averigüe cómo actualizar su navegador.</a> <a%s>Cerrar</a>';
    t.nl = 'Uw browser (%s) is <b>oud</b>. Het heeft bekende <b>veiligheidsissues</b> en kan <b>niet alle mogelijkheden</b> weergeven van deze of andere websites. <a%s>Lees meer over hoe uw browser te upgraden</a>';
    t.pt = '<b>Seu navegador (%s) está desatualizado</b>. Ele possui falhas de segurança e pode apresentar problemas para exibir este e outros websites. <a%s>Veja como atualizar o seu navegador</a> <a%s>Fechar</a>';
    t.sl = 'Vaš brskalnik (%s) je <b>zastarel</b>. Ima več <b>varnostnih pomankljivosti</b> in morda <b>ne bo pravilno prikazal</b> te ali drugih strani. <a%s>Poglejte kako lahko posodobite svoj brskalnik</a>';
    t.ru = 'Ваш браузер (%s) <b>устарел</b>. Он имеет <b>уязвимости в безопасности</b> и может <b>не показывать все возможности</b> на этом и других сайтах. <a%s>Узнайте, как обновить Ваш браузер</a>';
    t.id = 'Browser Anda (%s) sudah <b>kedaluarsa</b>. Browser yang Anda pakai memiliki <b>kelemahan keamanan</b> dan mungkin <b>tidak dapat menampilkan semua fitur</b> dari situs Web ini dan lainnya. <a%s> Pelajari cara memperbarui browser Anda</a>';
    t.uk = 'Ваш браузер (%s) <b>застарів</b>. Він <b>уразливий</b> й може <b>не відображати всі можливості</b> на цьому й інших сайтах. <a%s>Дізнайтесь, як оновити Ваш браузер</a>';
    t.ko = '지금 사용하고 계신 브라우저(%s)는 <b>오래되었습니다.</b> 알려진 <b>보안 취약점</b>이 존재하며, 새로운 웹 사이트가 <b>깨져 보일 수도</b> 있습니다. <a%s>브라우저를 어떻게 업데이트하나요?</a>';
    t.rm = 'Tes navigatur (%s) è <b>antiquà</b>. El cuntegna <b>problems da segirezza</b> enconuschents e mussa eventualmain <b>betg tut las funcziuns</b> da questa ed autras websites. <a%s>Emprenda sco actualisar tes navigatur</a>.';
    t.jp = 'お使いのブラウザ「%s」は、<b>時代遅れ</b>のバージョンです。既知の<b>脆弱性</b>が存在するばかりか、<b>機能不足</b>によって、サイトが正常に表示できない可能性があります。 <a%s>ブラウザを更新する方法を確認する</a>';
    t.fr = '<b>Votre navigateur (%s) est périmé</b>. Il contient des failles de sécurité et pourrait ne pas afficher certaines fonctionnalités des sites internet récents. <a%s>Mettre le navigateur à jour</a> <a%s>Fermer</a>';
    t.da = 'Din browser (%s) er <b>for&aelig;ldet</b>. Den har kendte <b>sikkerhedshuller</b> og kan m&aring;ske <b>ikke vise alle funktioner</b> p&aring; dette og andre websteder. <a%s>Se hvordan du opdaterer din browser</a>';
    t.sq = 'Shfletuesi juaj (%s) është <b>ca i vjetër</b>. Ai ka <b>të meta sigurie</b> të njohura dhe mundet të <b>mos i shfaqë të gjitha karakteristikat</b> e kësaj dhe shumë faqeve web të tjera. <a%s>Mësoni se si të përditësoni shfletuesin tuaj</a>';
    t.ca = 'El teu navegador (%s) està <b>desactualitzat</b>. Té <b>vulnerabilitats</b> conegudes i pot <b>no mostrar totes les característiques</b> d\'aquest i altres llocs web. <a%s>Aprèn a actualitzar el navegador</a>';
    t.fa = 'مرورگر شما (%s) <b>از رده خارج شده</b> می باشد. این مرورگر دارای <b>مشکلات امنیتی شناخته شده</b> می باشد و <b>نمی تواند تمامی ویژگی های این</b> وب سایت و دیگر وب سایت ها را به خوبی نمایش دهد. <a%s>در خصوص گرفتن راهنمایی درخصوص نحوه ی به روز رسانی
 مرورگر خود اینجا کلیک کنید.</a>';
    t.sv = 'Din webbläsare (%s) är <b>föråldrad</b>. Den har kända <b>säkerhetshål</b> och <b>kan inte visa alla funktioner korrekt</b> på denna och på andra webbsidor. <a%s>Uppdatera din webbläsare idag</a>';
    t.hu = 'Az Ön böngészője (%s) <b>elavult</b>. Ismert <b>biztonsági hiányosságai</b> vannak és esetlegesen <b>nem tud minden funkciót megjeleníteni</b> ezen vagy más weboldalakon. <a%s>Itt talál bővebb információt a böngészőjének frissítésével kapcsolatba
n</a>     ';
    t.gl = 'O seu navegador (%s) está <b>desactualizado</b>. Ten coñecidos <b>fallos de seguranza</b> e podería <b>non mostrar tódalas características</b> deste e outros sitios web. <a%s>Aprenda como pode actualizar o seu navegador</a>';
    t.cs = 'Váš prohlížeč (%s) je <b>zastaralý</b>. Jsou známy <b>bezpečnostní rizika</b> a možná <b>nedokáže zobrazit všechny prvky</b> této a dalších webových stránek. <a%s>Naučte se, jak aktualizovat svůj prohlížeč</a>';
    t.he = 'הדפדפן שלך (%s) <b>אינו מעודכן</b>. יש לו <b>בעיות אבטחה ידועות</b> ועשוי <b>לא להציג את כל התכונות</b> של אתר זה ואתרים אחרים. <a%s>למד כיצד לעדכן את הדפדפן שלך</a>';
    t.nb = 'Nettleseren din (%s) er <b>utdatert</b>. Den har kjente <b>sikkerhetshull</b> og <b>kan ikke vise alle funksjonene</b> på denne og andre websider. <a%s>Lær hvordan du kan oppdatere din nettleser</a>';
    t["zh-tw"] = '您的瀏覽器(%s) 需要更新。該瀏覽器有諸多安全漏洞,無法顯示本網站的所有功能。 <a%s>瞭解如何更新瀏覽器</a>';
    t.zh = '<b>您的网页浏览器 (%s) 已过期</b>。更新您的浏览器,以提高安全性和舒适性,并获得访问本网站的最佳体验。<a%s>更新浏览器</a> <a%s>忽略</a>';
    t.fi = 'Selaimesi (%s) on <b>vanhentunut</b>. Siinä on tunnettuja tietoturvaongelmia eikä se välttämättä tue kaikkia ominaisuuksia tällä tai muilla sivustoilla. <a%s>Lue lisää siitä kuinka päivität selaimesi</a>.';
    t.tr = 'Tarayıcınız (%s) <b>güncel değil</b>. Eski versiyon olduğu için <b>güvenlik açıkları</b> vardır ve görmek istediğiniz bu web sitesinin ve diğer web sitelerinin <b>tüm özelliklerini hatasız bir şekilde</b> gösteremeyecektir. <a%s>Tarayıcınızı nası
l güncelleyebileceğinizi öğrenin</a>';
    t.ro = 'Browser-ul (%s) tau este <b>invechit</b>. Detine <b>probleme de securitate</b> cunoscute si poate <b>sa nu afiseze corect</b> toate elementele acestui si altor site-uri. <a%s>Invata cum sa-ti actualizezi browserul.</a>';
    t.bg = 'Вашият браузър (%s) <b>не е актуален</b>. Известно е, че има <b>пропуски в сигурността</b> и може <b>да не покаже правилно</b> този или други сайтове. <a%s>Научете как да актуализирате браузъра си</a>.';
    t.el = 'Αυτός ο ιστότοπος σας υπενθυμίζει: Ο φυλλομετρητής σας (%s) είναι <b>παρωχημένος</b>. <a%s>Ενημερώστε το πρόγραμμα περιήγησής σας</a> για μεγαλύτερη ασφάλεια και άνεση σε αυτήν την ιστοσελίδα.';
    t.ar = 'متصفحك (%s) <b>منتهى الصلاحيه</b>. ويوجد به <b>ثغرات امنية</b> معروفة وقد <b>لا يُشغل كثير من الميزات</b> المتعلقه بهذه الموقع. <a%s>أضغط هنا</a>لتعرف كيف تقوم بتحديث متصفحك';
    t.sr = 'Vaš pretraživač (%s) je <b>zastareo</b>. Ima poznate <b>sigurnosne probleme</b> i najverovatnije <b>neće prikazati sve funkcionalnisti</b> ovog i drugih sajtova. <a%s>Nauči više o nadogradnji svog pretraživača</a>';
    t.la = 'Mēs vēlamies Jums atgādināt: Jūsu pārlūkprogramma (%s) ir novecojusi. <a>Atjauniniet savu pārlūkprogrammu</a>, lai uzlabotu drošību, ātrumu un pārlūkošanas ērtības šajā un citās lapās.';
    t.ga = 'Tá an líonléitheoir agat (%s) <b>as dáta</b>. Tá <b>laigeachtaí slándála</b> a bhfuil ar eolas ann agus b\'fhéidir <b>nach taispeánfaidh sé gach gné</b> den suíomh gréasáin seo ná cinn eile. <a%s>Foghlaim conas do líonléitheoir a nuashonrú</a>';
    t.lv = 'Jūsu pārlūkprogramma (%s) ir <b>novecojusi</b>.  Tai ir zināmas <b>drošības problēmas</b>, un tā var attēlot šo un citas  tīmekļa lapas <b>nekorekti</b>. <a%s>Uzzini, kā atjaunot savu pārlūkprogrammu</a>';
    t.no = 'Dette nettstedet ønsker å minne deg på: Din nettleser (%s) er <b>utdatert</b>. <a%s>Oppdater nettleseren din </a> for mer sikkerhet, komfort og den beste opplevelsen på denne siden.';
    t.th = 'เว็บไซต์นี้อยากจะเตือนคุณ: เบราว์เซอร์ (%s) ของคุณนั้น <b>ล้าสมัยแล้ว</b> <a%s>ปรับปรุงเบราว์เซอร์ของคุณ</a> เพื่อเพิ่ม ความปลอดภัย ความสะดวกสบายและประสบการณ์ที่ดีที่สุดในเว็บไซต์นี้';
    t.hi = 'यह वेबसाइट आपको याद दिलाना चाहती हैं: आपका ब्राउज़र (%s) <b> आउट ऑफ़ डेट </ b> हैं। <a%s> और अधिक सुरक्षा, आराम और इस साइट पर सबसे अच्छा अनुभव करने लिए आपके ब्राउज़र को अपडेट करें</a>।';
    t.sk = 'Chceli by sme Vám pripomenúť: Váš prehliadač (%s) je <b>zastaralý</b>. <a%s>Aktualizujte si ho</a> pre viac bezpečnosti, pohodlia a pre ten najlepší zážitok na tejto stránke.';
    t.vi = 'Website này xin nhắc bạn rằng: Trình duyệt (%s) của bạn hiện đã <b>lỗi thời</b>. <a%s>Hãy cập nhật trình duyệt của bạn</a> để tăng thêm tính bảo mật, sự tiện lợi và trải nghiệm tuyệt nhất trên trang web này.';

    var text = t[ll] || t.en;
    text = busprintf(text, bb.t, ' class="update arrow" href="//www.google.com/chrome" target="_blank"' ,' style="display:none"');
    var div = document.createElement('div');
    div.className = "browsercheck container";
    var _prtg = window._PRTG || undefined;
    div.innerHTML = '<div class="browsercheck_inner">' +
                        ( _prtg != undefined  
                          ? '<button title="'+_Prtg.Lang.Dialogs.strings.close+'" class="browsercheck-ignore ignore glyph-cancel-1"></button>'
                          : '<button class="browsercheck-ignore ignore glyph-cancel-1"></button>'
                        ) +
                        '<p>' + text + '</p>' +
                    '</div>';
    document.body.insertBefore(div, document.getElementById("container"));
    document.getElementsByClassName("browsercheck-ignore")[0].onclick = function(){
      !!localStorage && localStorage.setItem("browsercheck", false);
      div.style ="display:none"
    };
    !!localStorage && localStorage.setItem("browsercheck", JSON.stringify({l:ll,b:bb}));
  }

  function busprintf() {
    var args = arguments;
    var data = args[0];
    for (var k = 1; k <args.length; ++k)
      data = data.replace(/%s/, args[k]);
    return data;
  }

  function getURLParameter(name) {
    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
  }

  //test add browsercheck = {"l":"en","b":{"n":"c","v":10,"t":"Chrome 10","donotnotify":false,"mobile":false}} to localStrorage
  //or add browser=ABCD.12 to the URL
  var test = getURLParameter('browser');
  if(!!test)
    localStorage.removeItem("browsercheck")
  $buo({mobile: false}, test);

})(window, document);

function byId(id) {
  return document.getElementById(id);
}

if (sessionStorage.getItem('sessionExpired')) {
  document.getElementsByClassName("errormessage")[0].innerHTML = 'Your session has expired.';
  sessionStorage.removeItem('sessionExpired');
}

if(!document.addEventListener) {
    byId("unsupportedbrowser").style.display = "block";
} else {
  document.addEventListener("DOMContentLoaded", function(event) {
    var mobile = false;
    var unofficiallysupported=false;

    byId("loginusername").addEventListener('keydown',function(event){
        byId("loginpassword").type = "password";
    },{once:true})

    if (window.isunsupportedbrowser) {
      byId("unsupportedbrowser").style.display="block";
      return;
    }
    if (window.location.host=="localhost") {
      byId("dontuselocalhost").style.display="block";
    }
  });
}
</script>
<!--
//        You can use this file to modify the appearance of the PRTG web interface
//        as described in https://kb.paessler.com/en/topic/33
//        
//        Please note that you are using an unsupported and deprecated feature. 
//        Your changes will be broken or removed with future PRTG updates.
//        
//        If you modify this file, PLEASE LET US KNOW what you're changing and why!
//        Just drop an email to support@paessler.com and help us understand your 
//        needs. Thank you!       
-->

</body>
</html>
Get-Device : For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.
At line:1 char:1
+ Get-Device -Verbose
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Device], XmlException
    + FullyQualifiedErrorId : System.Xml.XmlException,PrtgAPI.PowerShell.Cmdlets.GetDevice
lordmilko commented 3 years ago

It seems your request to Get-Device has returned a web page from PRTG, rather than an XML response.

If you do

Set-PrtgClient -LogLevel All

Get-Device -Verbose

and then scroll back up, you'll see the API request that was executed for the request, which should be something like

http://prtg.example.com/api/table.xml?content=devices&columns=objid,name,location,host,group,probe,favorite,conditi
on,upsens,downsens,downacksens,partialdownsens,warnsens,pausedsens,unusualsens,undefinedsens,totalsens,schedule,basetyp
e,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&co
unt=*&username=prtgadmin&passhash=12345678

If you then copy and paste that address into your web browser, it should execute the same API request, giving you an XML document, not a web page. Are you able to confirm it said it was making a request similar to the above as well as what happens when you and copy and paste this in your browser?

KoalaScripts commented 3 years ago

Hello @lordmilko

That got me to the path to finding the issue . It is calling following : (Hid the pwd hash and our site )

https://www.PRTGSite.us.com//api/table.xml?content=devices&columns=objid,name,location,host,group,probe,favorite,condition,upsens,downsens,downacksens,partialdownsens,warnsens,pausedsens,unusualsens,undefinedsens,totalsens,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&username=4cffefa6-fa54-4c8e-9f4d-86c29b5ef31a&passhash=----------

at the end of the PRTG site there are 2 "/" I setup my initial connection with Connect-PrtgServer "https://www.PRTGSite.us.com/" -Credential $pscredential -PassHash Once this / at the end of the site got removed its all working!

Thank you very much for your assistance !

Ps: might be an option to catch this somewhere?

lordmilko commented 3 years ago

Thanks @KoalaScripts!

I have actually had a similar request for this in #206

This feature has been implemented and will be present in PrtgAPI 0.10 when it is released (no ETA)

Regards, lordmilko

lordmilko commented 3 years ago

Hi @KoalaScripts,

Please be advised PrtgAPI 0.9.15 has now been released which includes a fix for this issue

To update PrtgAPI, please run Update-Module PrtgAPI and reopen PowerShell

Regards, lordmilko