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

Get data from PRTG with Powershell



Is it possible to get data from PRTG, with powershell? Has anybody done that before?

I would like to receive data like disk-usages and uptime-information.

information powershell prtg

Created on Apr 7, 2016 7:14:16 AM

2 Replies



Sure, this is possible. PRTG offers an HTTP API which can be queried using Powershell. The API Dcoumentation can be found at YOUR_PRTG_SERVER/api.htm. I personally am using the Invoke-WebRequest cmdlet here. Example code below:

    [string]$user = "prtgadmin",
    [string]$pass = "prtgadmin",
    [string]$prtgserver = "",
    [string]$time = "yesterday",
    [string]$path = "D:\Temp\"
# function from http://stackoverflow.com/questions/11696944 to override SSL Cert check
function Ignore-SSLCertificates
    $Provider = New-Object Microsoft.CSharp.CSharpCodeProvider
    $Compiler = $Provider.CreateCompiler()
    $Params = New-Object System.CodeDom.Compiler.CompilerParameters
    $Params.GenerateExecutable = $false
    $Params.GenerateInMemory = $true
    $Params.IncludeDebugInformation = $false
    $Params.ReferencedAssemblies.Add("System.DLL") > $null
        namespace Local.ToolkitExtensions.Net.CertificatePolicy
            public class TrustAll : System.Net.ICertificatePolicy
                public bool CheckValidationResult(System.Net.ServicePoint sp,System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Net.WebRequest req, int problem)
                    return true;
    ## We create an instance of TrustAll and attach it to the ServicePointManager
    $TrustAll = $TAAssembly.CreateInstance("Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll")
    [System.Net.ServicePointManager]::CertificatePolicy = $TrustAll

$get_devices_uri = ("{0}/api/table.json?content=devices&output=json&columns=objid&username={1}&password={2}" -f $prtgserver, $user, $pass)

    $JSON = Invoke-WebRequest -Uri $get_devices_uri | ConvertFrom-Json
    Write-Host "Error. Cannot get device ids. Exiting!"
    exit 0
foreach($object in $JSON.devices){
    $destination = ("{0}\{1}.csv" -f $path, $object.objid)
    $get_messages_uri = ("{0}/api/table.xml?content=messages&output=csvtable&columns=objid,datetime,parent,type,name,status,message&filter_drel={1}&id={2}&username={3}&password={4}" -f $prtgserver, $time, $object.objid, $user, $pass)
        Invoke-WebRequest -Uri $get_messages_uri -OutFile $destination
        Write-Host "Error. Cannot get messages. Exiting!"
        exit 0

Above code gets messages from a sensor but can easily be adapted to sensor data. Please note that the function from Stackoverflow has to stay in place when you are using a self signed Certificate as this will (I know this is not optimal) overwrite the certificate check. If not needed please remove!

Created on Apr 7, 2016 1:36:05 PM by  Konstantin Wolff [Paessler Support]



Certainly done it before..

Have a look here:

Look at the function Get-prtgSensorData

Params: SensorID, [datetime]StartDate, [datetime]EndDate

Returns a table of the raw data.

More details here:

Created on Apr 21, 2016 11:43:48 AM

Last change on Jun 6, 2016 6:13:41 AM by  Luciano Lingnau [Paessler]

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.