How to run a PS script with many inputs, through Flow Designer/PS Step Action

Shawn Gienow
Tera Guru

I've created a Powershell step, and I'm trying to get the actual script to run.  I can run all kinds of simple PS, and have no issue passing a handful of input variables that then get used by the script.

Challenge:   The script I need to use has a lot of potential inputs, up to 39 in total.  

How can I send these inputs from the Flow, to the Action.

Right now, I am sending them in a string, ie:  

var psParms = "-input1 value1 -input2 value2... -input39 value39"

Then I send psParms to my action as the single input, and try to use the script, "run-script.ps1 $psparms" in the action, to no avail.

What I think I am running into, is that no matter how I try to add that string to the script, it sees it as a string type, rather than the switches for the PS script.

Is there a simple way to take that string, and have it be the parameters for that PS1 script?

8 REPLIES 8

Thank you, Manish.  Agreed, this would work, however I am trying to maintain as close to base systems/Out of box as possible, without increasing that.

I will use that, as a worst case.

Also when I mean 

$psParms = "input1=value1

 input2=value2

 input39=value39"

This is a string value to be stored in $psParms and can be passed as single variable and not 39 separate variables, when we use ConvertFrom-StringData, it will convert the string to array which can be directly passed.

But if your issue is to pass 39 variables individually then you can use the system properties which I shared in earlier post.

alexgg57
Tera Expert

You can reset it.

Table: [sys_properties]

properties:

{sn_flow_designer.max_action_vars}

{sn_flow_designer.max_script_variables}

We set it to 50

 

Thanks,
Alex.

Shawn Gienow
Tera Guru

What I have done for now, is send the input as one long string of the switches, to the PS action step as ps_script.

There, it runs "invoke-expression ".\script.ps1 $ps_script" and that is working.. its just not very "clean."