Start a new topic

Creating script Parameters in Powershell connector using dynamic folders

I am trying to create a powershell connector with a dynamic folder.

I already have the code available to retrieve credentials dynamically.

I have also successfully created the connector using a raw jSON connector.

I need to create 2 script paramters but the documentation is not clear on the syntax and I could not find an example in the repo.

I know the snippet below works when I created it in my raw jSON format.

I manually created the Parameters in the second tab and mapped those 2 parameters to the $EffectiveUsername$ and $EffectivePassword$ tokens.

And then I went to the Test tab and tested successfully.

"Script": "#Get RoyalTS Creds

param (

 [string] $userdn,

 [string] $userpw


$user = $uid

$userpass = $userpw


However when I referred to the online documentation


Type: string, Default Value: Empty String
The script parameters to pass on to the script.

It does not provide any sample syntax. Most of the parameters in the doco are clear, for example:

"Script" : "# powershell code......."

It is only the parameter and a value.

And I have figured out how to format extended Properties into a block.

However, the Parameters are a series of custom_parameter_name and parameter_Value grouped in the Parameters section of the Powershell-> Script block. I have tried multiple varieties of syntax of formatting but without a reference, it is impossible to script this key part of my script.

Thank you

Awesome! Glad it worked. I hope we can make this particular setting easier to access through the RoyalJson soon...

YES!!! That worked!

Thank you for your patience. I had tried several variations. Although I was add the newline character "\n" in my original script, I was not including it in my Parameter field.

Again, thank you for the assistance, this has been a great help.

A quick tip: if you are using a code editor like VS Code you can easily spot issues with malformed json as it constantly validates your json as you type. There are also a lot of extensions which may be helpful, like this one:

Hi again,

sorry this took so long. I was quite busy but I had some time today to take a closer look. Here's a quick summary what I found:

1. I was mistaken that the parameters XML must be an XML encoded string. It actually needs to be an escaped string for json.

2. The same applies to the script. New lines, etc. are not allowed. It must be escaped for json usage.

Here's a working example I just tested:

    "Objects": [
            "Type": "Credential",
            "Name": "DEVuser",
            "Username": "User123",
            "Password": "mysecretpassword",
            "ID": "Dev1"
            "Type": "PowerShellConnection",
            "Name": "Powershell-Dev",
            "Computername": "localhost",
            "CredentialMode": 3,
            "CredentialID": "Dev1",
            "Description": "Dev connection",
            "Properties": {
                "DefaultOutput": 1,
                "CredentialAutologon": false,
                "Parameters": "<ParamConfig xmlns:xsi=\"http:\/\/\" xmlns:xsd=\"\/2001\/XMLSchema\">\n                    <ParamConfigItems>\n                        <ParamConfigItem>\n                            <ParameterName>Param1</ParameterName>\n                            <Value>$$EffectiveUsername$$</Value>\n                            <TestValue />\n                       </ParamConfigItem> \n                        <ParamConfigItem>\n                            <ParameterName>Param2</ParameterName>\n                            <Value>Some Value</Value>\n                            <TestValue />\n                        </ParamConfigItem>\n                    </ParamConfigItems>\n                </ParamConfig>"
            "Script": "#Get RoyalTS Creds\nparam ([string] $uid,\n            [string] $userpw,\n            [string] $Param3)\n      Set-PSDebug -trace 1\nwrite-host $uid\nwrite-host $userpw\nWrite-host $Param3\nWrite-host $Param4\nwrite-host 'CredUser Name' $$CredentialUsername$$ \nwrite-host 'password' $$CredentialPassword$$\nwrite-host 'Effective user' $$Effectiveusername$$\n"

Let me know if this works for you.


Thank you for the clarification. However, I had also tried that format as well without success.

I  had add backslash to escape the double quotes as well as the forward slash. Although the JSON Verify button reported success, when I reloaded and opened the generated Powershell connector object, the Script section would error with a "Royal TS has encountered a problem" Error Report.

Even through the JSON is verified, the XML still does not seem to be be interpreting the escape code  as expected.

I even created a object manually, saved it and copied the XML from that directly and inserted the backslashes like your example. 

And I did try you example directly assuming that it should at least result in the parameters showing up in the generated object. Which would at least have given me a working model.. 

Hi Nino,

I think I can see the confusion ;)

In my previous post, I showed you how to "build" the XML for each parameter. The XML must be inserted as "XML encoded string" into the json. Here's the example I used:

"Properties": {
    "Parameters": "&lt;?xml version=\"1.0\" encoding=\"utf-16\"?&gt;&lt;ParamConfig xmlns:xsi=\"http:\/\/\/2001\/XMLSchema-instance\" xmlns:xsd=\"http:\/\/\/2001\/XMLSchema\"&gt;&lt;ParamConfigItems&gt;&lt;ParamConfigItem&gt;&lt;ParameterName&gt;Param1&lt;\/ParameterName&gt;&lt;Value&gt;$EffectiveUsername$&lt;\/Value&gt;&lt;TestValue \/&gt;&lt;\/ParamConfigItem&gt;&lt;ParamConfigItem&gt;&lt;ParameterName&gt;Param2&lt;\/ParameterName&gt;&lt;Value&gt;Bla&lt;\/Value&gt;&lt;TestValue \/&gt;&lt;\/ParamConfigItem&gt;&lt;\/ParamConfigItems&gt;&lt;\/ParamConfig&gt;"

Does this help?


Thank you for your earlier responses, but either this functionality does not work or it is not clear what the jSON syntax and object names should be are documented.

I have now given up on on this because it does not appear to actually work.

I have found an entry in the online doco at:

But it appears to stop short of details or even an example.


Type: string, Default Value: Empty String
The script parameters to pass on to the script.

I have had tremendous success with creating JSON objects for credentials and connections, as well as applying Properties with additional parameters values.

However, I am now guessing at what to do after Parameters. I am able to construct a variety of JSON blocks without errors, (including your example) but no success in the resulting connection object.

As I said earlier, if this feature does work, there are no Powershell examples in the samples folders to clarify this use case. 

Below is my best guess at what the Properties should look like if I was to assign multiple parameter values, but they do not result in being defined in the generated connections.

  "Properties": {          

  "Parameters": [

  { "Parametername": "Param1", "Value": "Value1" }, 

  { "Parametername": "Param2", "Value": "Value2"}



Above does not work.

Thank you. 

I will see if i can make some headway on my own. I just want to make sure I understand the method.

If I am successful, I will pass the information back.

Hi Nino,

you first need to create the XML according to your requirements. Once you have that, you need to encode the XML block into a XML-encoded string (like the line 1 in the screenshot). This string must then be added to the Properties -> Parameters property in the rJson (see

I'm not a PowerShell expert. I guess you can use the XML powershell cmdlets to create the paramters XML and also use a cmdlet to encode it into a string. In C# I would youse the XmlTextWriter.WriteString method but there's probably a better way to do it in PowerShell.

Let me know if this helps. I'm currently quite busy and don't have much time to provide more details. If you need further help with that, I'm happy to dig deeper and provide a more complete sample.


Or are you saying I can insert the XML block into the jSON code.? 

I am uploading the script I have been testing with. I feel I may completely missing the point. 

I created a password object and tried to assign it to the PowerShell connection object. 

And want to pass the credential into the powershell script by assigning it to $uid and $userpw. 

I could be way off.


Yes, I think I may need guidance. I understand the XML code that is stored in the .rtsz file and how it related to the Parameters panel in the RoyalTS Properties screen. 

I also review the link you provided in the online doco which refers to the Advanced scenarios.

Currently, i first try to create the dynamic folder with just jSON format before I create my powershell script, so I can use that to model my script output.

However, I assume I would add something like the following jSON into my connection object.

  "Properties": {

    "Param1": "$EffectiveUsername$",

    "Param2": "Some Value"


But that does not seem to work.

I am assuming the result would be Param1 and Param2 being visible in the Parameters panel.

 I am trying to some variations, but I feel I must be missing something in translating the custom Powershell parameters into the jSON

Hi Nino,

the sample I included in the docs is the very same as the one above. Do you still need assistance to incorporate this into your script?


I will take a look. But I will also look forward to your samples to help provide guidance in how to incorporate into my scripts.

Thank you.



you can specify the script parameters using a simple XML encoded string. Here's an example:

Line 4 to 18 in the screenshot above shows the XML which is expected by Royal TS/X. 

Line 1 shows the actual property value as XML encoded string.

You can create the following XML:

<?xml version="1.0" encoding="utf-16">
<ParamConfig xmlns:xsi="" xmlns:xsd="">
            <TestValue />
            <Value>Some Value</Value>
            <TestValue />

Set this XML as XML encoded string to the Parameters property as described in the Advanced Scenarios topic:

I hope this helps. I will also include the XML sample in the docs.


Login or Signup to post a comment