PE233 and PE231 Error with a Powershell Script for a Custom XML Sensor (EXE/Script Advanced) for PRTG Network Monitor

Recently I wrote a Powershell sensor for PRTG and wanted to use it as EXE/Script Advanced sensor on a Windows 10 Home (Build 1607) Probe system.

So I copied my xyz.ps1 file into the correct folder:

C:\Program Files\PRTG Network Monitor\Custom Sensors\EXEXML

Then I created a new EXE/Script Advanced Sensor and selected xyz.ps1 as my Script.

But when the sensor ran for the first time I got the message:

XML: The returned XML does not match the expected schema. (code: PE233) — JSON: The returned JSON does not match the expected structure (No mapping for the Unicode character exists in the target multi-byte code page). (code: PE231)

The reason is that Powershell didn’t actually execute the sensor code but gave back the following error message (which obviously PRTG couldn’t interpret at XML):

File C:\Program Files\PRTG Network Monitor\Custom Sensors\EXEXML\xyz.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170. + CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnauthorizedAccess

To fix this I had to allow Powershell Scripts to be run on the probe system by executing the following command in a command-line-window (cmd.exe) with admin rights (see Paessler knowledge base):

powershell.exe "Set-ExecutionPolicy bypass" 

There might be more secure settings, that also work, but I didn’t bother with that.

Now my Powershell script works fine.

Author: Dirk Paessler

Founder and Chairman, Paessler AG

3 thoughts on “PE233 and PE231 Error with a Powershell Script for a Custom XML Sensor (EXE/Script Advanced) for PRTG Network Monitor”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s