<%NUMBERING1%>.<%NUMBERING2%>.<%NUMBERING3%> PRTG Manual: Escape Special Characters and Whitespaces in Parameters

You must escape special characters in parameters that you pass to an executable or script and surround them with quotation marks to make sure that the characters are correctly interpreted. PowerShell scripts in particular require adequate escaping so that the parameters are passed in a valid PowerShell syntax. PRTG automatically does most of the escaping for you.

Follow these rules to escape special characters and whitespaces in the parameters fields:

Rule

Syntax

Result

Use double (") or single (') quotation marks for parameters that contain whitespaces.

-name "Mr John Q Public"
-name 'Mr John Q Public'

Mr John Q Public

Use double quotation marks (") for parameters that already contain single quotation marks (').

-name "Mr 'John Q' Public"

Mr 'John Q' Public

Use single quotation marks (') for parameters that already contain double quotation marks (").

-name 'Mr "John Q" Public'

Mr "John Q" Public

Use a backslash (\) to escape and pass a literal double quotation mark.

i_round_redThis syntax is not valid for PowerShell scripts. See below for how to escape double quotation marks in PowerShell scripts.

-name pub\"lic

pub"lic

Use double quotation marks (") for parameters that contain double ('') and single (') quotation marks. You must still escape the double quotation marks (") that you want to keep.

i_round_redThis syntax is not valid for PowerShell scripts. See below for how to escape double quotation marks in PowerShell scripts.

-name "pu'b\"lic"

pu'b"lic

PowerShell Specific Syntax

Powershell requires different escape syntax to escape and pass a literal double quotation mark ("):

Rule

Syntax

Result

Use two double quotation marks (")

-name pub""lic

pub"lic

Use a backtick (`)

- name "pu'b`"lic"

pu'b"lic

i_round_blueIn SSH scripts, you can use alphanumeric characters and the special characters ".", "_", "-", "=", and "/" outside of quoted strings.

i_round_blueWe recommend that you do not pass passwords in parameters. Use placeholders instead. For more information, see section Custom Sensors.