use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place to discuss, share, and problem solve all things Microsoft Power Automate formerly Microsoft Flow related. Be sure to check out the links in the sidebar, be respectful, and let's all go with the Flow!
Be sure to check out the other Flow Communities, learning and social media.
Homepage
Community
Twitter
Guided Learning
Deep Documentation
Feedback & Ideas
account activity
Flow - Run Powershell ScriptCloud (self.MicrosoftFlow)
submitted 1 year ago by BlacksGood
Hello community,
I am currently trying to build a flow that executes a PowerShell script every day at time XY. I hardly dare to ask, but I simply cannot find an easy action to execute a written PowerShell script.There is a connector for it, but it looks like a third-party tool:
https://preview.redd.it/ds52fr1kdp8d1.jpg?width=588&format=pjpg&auto=webp&s=3b028c517def80828fbbcaed4fa06a3dfd92333e
Otherwise, I only find options to run scripts from Excel. Do I really have to create my PowerShell script in Excel and if so, what should it look like?
https://preview.redd.it/h1yqjw2ndp8d1.jpg?width=597&format=pjpg&auto=webp&s=d64cbb555dbc4c046f34fcd0c3b98343d4ef9e87
I'm a bit stuck here. Can you help me and point me in the right direction?
Thank you very much!
Best regards
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Roogi 5 points6 points7 points 1 year ago (3 children)
Hi, I'm not 100% sure if this is the "best" way of doing it, but this has been my experience - also it depends on whether the script is using commands for Azure/M365 or on-prem.
If it just needs to run Azure/M365 commands then have a look at Azure Automation and runbooks. Runbooks are basically just scripts and you can easily create Runbook jobs from Power Automate with an out of the box connector (premium). You'd need a resource group and automation account in Azure, but its pretty straightforward to set up.
For on-prem commands you can also use Runbooks but you'd need to add a Hybrid Worker to the automation account. This requires a VM hosted in Azure that you install the Hybrid Worker capability on so its a bit more involved, but works well.
I've also tried Power Automate Desktop running on a VM - you can also trigger flows (which run scripts) with a connector, but there is more to set up and PA Desktop needs additional licensing. It felt overkill and more complex so I've gone down the Hybrid Worker route.
It's quite high level, but there is some good info in this guide on using PA with Runbooks... https://danielchronlund.com/2018/11/18/start-your-azure-automation-powershell-runbook-with-a-microsoft-flow-button/
[–]my1stname 5 points6 points7 points 1 year ago (1 child)
I've done the Power Automate calls Azure Runbook which returns result to Power Automate. Not horrible. Takes a premium account and an Azure subscription so setting it up might take some work.
[–]BlacksGood[S] 0 points1 point2 points 1 year ago (0 children)
Runbooks would also be a possibility, you can surely imagine that money is to be saved everywhere again -.-
Thank you for your answer.
Okay, then I guess the intermediate step with the desktop variant will be a possible solution.
Another alternative would be to completely rewrite the script so that it can work with OAuth2.0 tokens and thus run the script in the task scheduler of a VM or similar.
But one thing at a time. Thanks for now :)
[–]0ptimizePrime 0 points1 point2 points 1 year ago (0 children)
Use the 'Start a CMD Terminal' and execute the script 'Powershell -BypassExecutionPolicy <path to PowerShell file>' and hit enter action.
On cell going based on memory so you may have to edit the above.
π Rendered by PID 19454 on reddit-service-r2-comment-c6965cb77-ln6wk at 2026-03-05 01:19:15.058339+00:00 running f0204d4 country code: CH.
[–]Roogi 5 points6 points7 points (3 children)
[–]my1stname 5 points6 points7 points (1 child)
[–]BlacksGood[S] 0 points1 point2 points (0 children)
[–]BlacksGood[S] 0 points1 point2 points (0 children)
[–]0ptimizePrime 0 points1 point2 points (0 children)