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:

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

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

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

-name "Mr 'John Q' Public"

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

-name 'Mr "John Q" Public'

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

-name pub\"lic

  • Use double quotation marks (") for parameters that contain double ('') and single (') quotation marks and escape double quotation marks (").

-name "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.