Hi, I have an existing flow where it fetches data from email and save it to a csv file with header. I have created another flow in Power Automate Desktop version to run a PowerShell script. I have added UI flow to my existing flow with input variable but script is unable to identify the input parameters. Could you please suggest next steps.
Solved! Go to Solution.
Initially, you should create the respective Input parameters in the Power Automate Desktop Designer (more info here). The Input parameters included in the already existing Flow should be created also in Power Automate Desktop.
After that, you could check whether the Powershell script is being executed successfully in the Designer using the Input's default value.
I hope the above helps.
Yes, I have created input variables in Power Automate Desktop App. Below pictures for reference.
We do not have any default value for input. Below is the screenshot from my existing flow and output of the step when flow runs.
Hello again rushirohit.
Unfortunately, the screenshot from your existing flow is not displayed. I would recommend using a default value for your Input parameter in order to check during Debugging if the Parameter's value is being taken into account in the PowerShell execution.
For example, I have followed the below steps:
1. Create the Input parameter in Designer using a default value
2. Create the Poweshell Action and use the specific Parameter in my Powershell code
3. The Input parameter is used in the execution as it could be observed from the Powershell Output parameter.
Yes, if we provide a single PowerShell command it works. When I am trying to run .ps1 or .bat file it does not take the input.
I did save "Write-Host $SSO" in a sample script and tried to run the script.
In order to use a Parameter as a dynamic value in a PowerShell script, the actual PowerShell code has to be inserted in the 'PowerShell code to run' field of the 'Run PowerShell script' Action. When a user inserts the file path of a PowerShell script file, the script will be executed successfully but the Parameter will not be handled as a Variable(dynamic) but as text (static).
I hope this helps.
Hello @NikosMoutzou ,
Could you please suggest how I can add multiple commands into a single action because we have commands to connect to different services and a function with 10 lines of code and then actual command to run.
I suggest that you manually store the commands into a text file. Then, using the "Read text from file" action, the whole text can be saved into a variable.
This variable can be entered as an input to the "Run PowerShell script" action.
I hope the above helps!
I did try the suggested solution it's not successful. I have created a ticket with MS, but it's not helpful. Could you please suggest next POA.
Rushi Rohit Kotha
Hi, I have run into a similar issue but where I can't run my PowerShell script as "admin". Running through script on it's own works but when I run it with Desktop Flow I get access denied and have no other way of forcing it to run as an admin.
I found this thread interesting. Were you able to get it to run a locally saved script and still write back the output to your flow? How did you go about it?
Thanks in advance:)
I didn't really have any issues with Admin mode. Saying that though, I only tried a basic example. The only thing that may help, I'm not sure if this will work, is to change the UAC settings on your system, which may always force the Powershell session to always run in Admin mode. Not ideal I know.
In the end I abandon this approach as I had issues with being granted access to the gateway service within the company I worked for. So to get around it, I used Azure DevOps, stored my PS scripts with in Azure DevOps Git and installed an agent on the server. I'm not sure on the cost implications yet though
Not sure if that helps, but just a thought
Yeah I tried that, I temporarily disabled all UAC and made PowerShell ISE (all 4 versions) run as admin by default. I also made Power Automate Desktop App run as admin by default and to top it off, I'm a local administrator and no luck.
I can run an AD script fine if I launch ISE as an admin but when it runs using w/e framework Flow uses, it runs as a mortal user and there's NO way to force it to run as admin so I'm out of luck I guess.
Learn how to create your own user groups today!
Check out the new Power Platform Community Connections gallery!
Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.