top of page

Turn Power Automate Flows on in Bulk with PowerShell

If you've ever had to manually toggle Power Automate flows on and off across multiple solutions, you'll know how tedious it gets. Click into the flow, wait for the page to load, turn on/off and repeat. Twenty times. It's slow and frankly beneath anyone's dignity.

We wrote a small set of PowerShell scripts to automate exactly this, and this post walks through the problem they solve and how to use them together. The scripts can be downloaded from our Powershell Repo on GitHub.


The Problem

We have two Power Platform solutions that contain a collection of flows handling data sync, approvals, and notifications. Often, these flows need to be turned on after a deployment or environment copy.

The catch: not all flows need to be turned on. There are a handful of flows that send outbound emails — confirmation messages, alert notifications, that sort of thing. Those should always remain off outside of production. If they fire during a test run, real people get real emails. Which is not ideal.

So the requirement is:

Turn on (or off) every flow in our two solutions, but ensure the email flows are always disabled.

The Solution

We built three scripts that work together:

  • PowerPlatformShared.psm1 — handles authentication once, shared across the other two scripts, so you're never prompted to log in twice

  • Get-FlowsFromSolutions.ps1 — queries Dataverse and returns the display names of every flow in one or more named solutions

  • Enable-PowerAutomateFlows.ps1 — takes that list of flow names and enables or disables them


The key insight is that these are composable. The output of Get-FlowsFromSolutions feeds directly into the -FlowNames parameter of Enable-PowerAutomateFlows. Additionally, PowerShell's array filtering makes it straightforward to exclude specific flows before passing the list across. The scripts can be downloaded from our Powershell Repo on GitHub.

How We Turn on Flows in Bulk using PowerShell

Here's exactly how we run it. Firstly, import required modules

Now define variables for excludedFlows, environment and solutions.

NOTE - excludedFlows are flows that should always be turnedOff.

Then, connect to the Dataverse environment and pull all flow names from both solutions:

Filter out flows that should be disabled and enable the remaining flows:

Then disable the excludedFlows (just in case they have been turned on at same point)


Comments


bottom of page