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.