New Question
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Download >>


What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more


Top Tags

View all Tags

How can I show special characters with EXE/Script sensors?



Your Vote:



The script that my custom EXE sensor runs returns special characters which are encoded. So, for example, some channel names contain diacritics and “Umlaute” (in German) which are not correctly displayed in PRTG.

How can EXE/Script sensors display special characters, for example, in channel names or sensor messages?

custom-script-exe encoding exe-script-advanced-sensor exe-script-sensor exexml prtg special-characters

Created on Jun 3, 2015 4:26:37 PM by  Gerald Schoch [Paessler Support]

1 Reply

Accepted Answer



Your Vote:



This article applies to PRTG Network Monitor 15.2.16 or later

Correct Display of Special Characters in EXE/Script Sensors

If you use an EXE/Script sensor or an EXE/Script Advanced sensor and the executed script returns encoded special characters (for example, diacritics), PRTG might not display these characters correctly in the sensor message or in channel names. As of PRTG version 15.2.16 you can define the encoding explicitly in the target script. In previous versions PRTG tried to determine the encoding merely by chance which did not work in every case.

You have to provide the following information in the script:

  • Your script has to start with the following line:
    [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
  • If you use the EXE/Script Advanced sensor which returns XML, you have to additionally add the following line at the beginning of the XML output: <?xml version=`"1.0`" encoding=`"UTF-8`" ?>
    Please note the backticks in front of the quotation marks encoding the attributes! These are necessary for correct escaping.
  • The text of both the EXE/Script and the EXE/Script Advanced sensor has to be returned with the following command at the end of the script: [Console]::WriteLine($output)

Defining your script this way ensures the correct display of special characters in PRTG.

Note: VBScript seems not to be able to encode text in UTF-8. Please use PowerShell instead.

Note: If you use an SSH Script Advanced sensor, you also have to provide a correct XML declaration in the script.

Update PRTG 17.1.29: As of PRTG version 17.1.29 you can use escape sequences for special characters (for example, &#xb0;). Please note that this only applies to sensor message and custom units, it does not work with channel names.

Default Encoding

If you do not define the encoding in PRTG 15.2.16 or later, PRTG will take the following default encoding:

  • EXE/Script sensors: OEMCP encoding from HLKM\SYSTEM\CurrentControlSet\Control\Nls\CodePage
  • EXE/Script Advanced sensors: UTF-8 for both XML and JSON

Sample structure of a corresponding PowerShell script:

[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$output = @"
<?xml version=`"1.0`" encoding=`"UTF-8`" ?>


But I get "The handle is invalid" when I try to run the script?
This happens sometimes for yet unknown reasons. In order to fix it, instead of starting the script with the output encoding, use the following:

# create temporary console
ping localhost -n 1 | Out-Null
# set output encoding
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

Further information about this can be found in this technet forum thread.

Created on Jun 3, 2015 4:27:49 PM by  Gerald Schoch [Paessler Support]

Last change on Jul 19, 2017 4:46:00 PM by  Gerald Schoch [Paessler Support]

Please log in or register to enter your reply.

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.