Powershell Encoding Problem

I have a Windows agent plugin in Powershell which Outputs special characters. It works on the Powershell and ISE but refuses to encode them correctly in the Agent. The following example

Write-Host '<<<encoding_test:sep(9)>>>'
Write-Host 'Hello ä é ô'

results in the agent output

Hello „ ‚ “

The agent seems to do some magic with utf16 to utf8 conversion, however this does not help here, the output is not encoded correctly. Does anyone has a idea how to solve this?



Give it a try:

1 Like

Hi Tavanze,

I tried both trickt, the one with the OutputEncoding as well as re encoding the file but neither helped sadly.


What version of your check_mk_agent do you use?
There where changes over the time for the output encoding.

Hi Andreas,

I used 1.6.0p5 and 1.6.0p11 for the testes.


I have solution for you :slight_smile:
The powershell file must be saved with encoding “UTF-8 with BOM” and you need to use an encoding setting in the header line. Like the following example

Write-Host('Test ÄÖÜ - Hello ä é ô')

Output on the monitoring system looks like this.

I think the most important part is the “cp437” codepage and the format of your powershell script with “UTF-8 with BOM”


Thank you Andreas, this solved the problem.