Hi.

I have a Problem with a Custom Powershell Sensor. Version: 15.1.15.2021

I added a testfile "test.ps1" to PRTG Network Monitor\Custom Sensors\EXEXML.

Content: Write-Host "<prtg>" "<result>" "<channel>name</channel>" "<value>1</value>" "</result>" "</prtg>" Exit 0

If I add a sensor, I get the following error: XML: Structural error in xml file, 1 open items. -- JSON: Das zurückgelieferte JSON entspricht nicht der erwarteten Struktur (Invalid JSON.). (Code: PE231)

Can you help me?


Article Comments

Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.

What happens when you manually execute the script on your PRTG server?

Is running powershell scripts enabled on your PRTG server?


May, 2015 - Permalink

Execution-Policy is set to Unrestricted.

If I execute the script, I get the following content: <prtg> <result> <channel>name</channel> <value>1</value> </result> </prtg>


May, 2015 - Permalink

Can you try the following code:

Write-Host @" <prtg> <result> <channel>name</channel> <value>1</value> </result> </prtg> "@

Has Set-ExecutionPolicy Unrestricted been executed in a 32 bit PowerShell with administrative privileges?


May, 2015 - Permalink

Hi.

I worked with Powershell x64. After i set the Executionpolicy to Unrestricted twice in x86 it worked.

Many Thanks


May, 2015 - Permalink