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

Remote Execution PowerShell Custom Sensor Windows Backup



I created a PowerShell script which checks the Windows Backup EventLogs for errors. The script is signed and it works when i run it manually from a different machine. For whatever reason, PRTG always returns the value 1, but it should return 3:Error (for testing). I have used the Invoke-Command cmdlet. I assume the script runs on the PRTG machine locally instead on the remote server. How can i debug this?

The other problem i'm facing is to replace the computer name with a variable %host, but this seems to be ignored by PRTG...

Invoke-Command -ComputerName servername{ $date=(Get-Date).AddDays(-100) $events=Get-WinEvent -LogName Microsoft-Windows-Backup| Where-Object {$_.TimeCreated -gt $date} | Group-Object -Property "LevelDisplayName" -NoElement IF ($events.Name -like "*Error*"){ $output = 3 Write-Host $output,":Error" IF ($events.Name -like "*Warning*"){ $output = 2 Write-Host $output,":Warning" } } ELSE { $output = 1 Write-Host $output,":OK" } }

powershell remote windows-backup

Created on Jun 13, 2016 8:30:41 PM

3 Replies



You may want to take a look at monitoring historic Windows events :) It can also access remote hosts.

Created on Jun 14, 2016 12:29:10 PM by  Stephan Linke [Paessler Support]



Thanks! I works at the meantime, i had to change the user of the PRTG services from local system to a domain user.

Created on Jun 14, 2016 1:06:57 PM



Nice that it works :)

Created on Jun 14, 2016 1:24:04 PM by  Stephan Linke [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.