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

XML EXE Script Sensor - Win10 Powershell



I have successfully added a Demo sensor using the Demo Batch file provide in the PRTG Windows installation.

C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\Demo Batchfile - Returns static values in four channels.bat

I'm now trying to program the exact equivalent in a Powershell Script, but so far it's not working.

I get the Sensor message "XML: The returned XML does not match the expected schema. (code: PE233)"

As far as I can tell the XML formatting is as it should be. I've also set Powershell script permissions to 'Unrestricted'.

As a simple Powershell test I've simplified the XML generated to something very basic, but still no luck.

Cannot find any log messages that may gives further debug information.

Windows Powershell file 'test.ps1' contents:

$result = "<?xml version=`"1.0`" encoding=`"UTF-8`" ?>`r`n"\\
$result += "<prtg>`r`n"\\
$result += "<result>`r`n"\\
$result += "<channel>Minimum</channel>`r`n"\\
$result += "<value>3</value>`r`n"\\
$result += "</result>`r`n"\\
$result += "<text>Test values. OS: %OS%</text>`r`n"\\
$result += "</prtg>`r`n"\\
write-host $result\\
exit 0 \\

Not sure why it's not working. What am I missing?

Would it be possible for you to please provide a working Powershell Script (.ps1) that performs the exact same function as the 'Demo Batchfile - Returns static values in four channels.bat'

Thanks, Rod

exe powershell xml

Created on Nov 9, 2020 1:21:38 AM

Last change on Nov 9, 2020 5:52:23 AM by  Marijan Horsky [Paessler Support]

4 Replies



Hello Rod,

Thank you for your post.

Here is a Powershell version of the script:

write-host @"
<?xml version="1.0" encoding="UTF-8" ?>
<Channel>Disk Free</Channel>
<LimitWarningMsg>My custom note for warnings</LimitWarningMsg>
<LimitErrorMsg>My custom note for errors</LimitErrorMsg>
<Channel>Network Speed</Channel>
<channel>Demo Custom</channel>

Please note that this script can be used only as a example for how the output should be formatted, since it only displays static values.

Kind regards,
Sasa Ignjatovic, Tech Support Team

Created on Nov 9, 2020 11:26:42 AM by  Sasa Ignjatovic [Paessler Support]



Thankyou for the Powershell equivalent of the Demo.bat. I copied & pasted the script into Demo.ps1. It worked first time!

I then made a slight change & it stopped working with same error "XML: The returned XML does not match the expected schema. (code: PE233)".

I then recreated the script from your original demo script, but it no longer works despite many attempts & deleting/adding sensors & many .ps1 files.

Is there an error log I could check? Something that allows inspection of the returned XML? Something to check that Powershell is being called with appropriate permissions & is responding?

Thanks, Rod

Created on Nov 10, 2020 9:39:07 PM



Hello Rod,

You can enable the option "Write EXE result to disk" in the settings tab of the sensor. Let the sensor run for a couple of scan so that the log files can be generated. The files will be stored on the Probe host that runs the sensor, and per default they are stored in: C:\ProgramData\Paessler\PRTG Network Monitor\Logs\sensors
The files will be named "Result of Sensor ID" (where ID is the ID of the sensor).

Created on Nov 11, 2020 8:28:41 AM by  Sasa Ignjatovic [Paessler Support]



All fixed. Thankyou.

The sensor log showed Demo.ps1 'cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.'

I had previously used Powershell to change the ExecutionPolicy to Unrestricted, but not used the LocalMachine scope, so it wasn't remembered after the current process closed.

I then used Powershell with Run as administrator option & executed "> Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine", but it still didn't work.

Finally, I opened the Local Group Policy Editor and navigate to Computer Configuration -> Administrative Templates -> Windows Components -> Windows PowerShell. Double-click a setting called “Turn on Script Execution” on the right pane. Select the Enabled option. Beneath it, you can click the drop-down list to set the execution policy to “Allow local scripts and remote signed scripts". Click OK to save your changes.

Now it works.

Created on Nov 11, 2020 10:12:31 PM

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.