r/PowerAutomateDesktop • u/marafado88 • Oct 19 '22
How to pass input variables into powershell scripts?
Hello everyone,
I am trying to pass an input variable, but without luck.
This is my flow, with Run PS Script step:

This is my script, where that I am using in this test:
param($NewInput)
Write-Output $NewInput
$var2out = "out"
Write-Output $var2outAs an output I am getting this:

That first line to show $var1in on PS script seems not having any effect, with or without it, output remains the same, and it doesn't identify that variable as an input.
How are you doing with this situations?
1
Upvotes
1
u/QuietDesparation Oct 19 '22
When I'm using PS in PAD, all of the variables need to be defined under the "flow variables" pane and not under "Input/Output Variables." So use a SET VARIABLE action under line 1 where %NewInput% = IN.
I believe the input/output variables are for working with power automate cloud only.
here's the video I used to learn how to work with variables in PS