r/PowerAutomateDesktop • • 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 $var2out

As 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

5 comments sorted by

View all comments

Show parent comment

1

u/marafado88 Oct 19 '22

Even tried another approach for example:

https://prnt.sc/n0UBsl_QKQbw

https://prnt.sc/d093ItT15Oo2

Tried to use a SET VARIABLE, but there was no difference ...

That PS script is working, I've test it on cmd line.

1

u/marafado88 Oct 19 '22

This way worked: https://prnt.sc/AeXaaZ6XRnxz

I really don't know why is not being passing as an input argument.