Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > How to use PowerShell to Find all the Flows in Your Tenant
July 15
How to use PowerShell to Find all the Flows in Your Tenant

I have a OneNote file that is full of blog posts that seemed like a great idea at the time, but never saw the light of day for various reasons. Maybe I couldn’t research it as much as I wanted, maybe I couldn’t make it as thorough as I wanted, maybe I just got distracted by something shiny. This blog post is one of them. I was never confident enough to post this one, but given all the Workflow excitement, and a couple of customer requests I decided to dig in and get serious about it. So here it is, two years after I first took the notes for it.

As an administrator, I find myself frustrated a lot by the lack, or at least lack of understanding on how to manage Flows and Power Apps. They never quite behave exactly like I want them to. One of the things that keeps coming up is being able to get a list of all of the Flows in a Tenant. This could be for licensing questions, migrating questions, or just plain curiosity. Whatever it is, it’s never as easy as I want it to be. Being the fanboy of PowerShell that I am, that’s where I looked. Without boring you with a lot of story part, I’ll show you the PowerShell I settled on.

Get-AdminFlow | ForEach-Object { $user = Get-UsersOrGroupsFromGraph -ObjectId $_.CreatedBy.userId;[PSCustomObject]@{ FlowName = $_.DisplayName; OwnerName = $user.DisplayName ; OwnerEmail = $user.UserPrincipalName ; }; }

Let’s break that down a bit. You’ll need to install the PowerApps and Flow for Admins module. Install the PowerApps and Flow for Makers module while you’re at it. If you don’t run Add-PowerAppsAccount and add your Tenant Admin account you’ll get prompted for authentication the first time you run Get-AdminFlow.

Get-AdminFlow lists all of the Flows in a tenant, but not in the most user friendly way:

image

So I cleaned it up a bit. Using ForEach-Object I walk through each Flow. I use Get-UsersOrGroupsFromGraph to get the Owner object. Then I create a PSCustomObject and populate it with the Flow’s DisplayName and the user’s DisplayName and UserPrincipalName properties. It looks like this:

image

Making it an object is a little extra work as opposed to just spewing it onto the screen with Write-Host. But it’s worth the extra effort because I can send it down the pipeline and do more with it. For instance, I can easily pipe it out to a CSV file by appending | Export-Csv -Path .\Flows.csv –NoTypeInformation to the end.

image

That seems a bit anticlimactic at first, but open up that CSV file and prepare to be amazed.

image

If you want different information about each Flow, run Get-AdminFlow | Get-Member and see what other properties are exposed to you.

Let me know if this helps and what else you’d like help with.

tk

ShortURL: https://www.toddklindt.com/POSHFindAllFlows

Edit 7/15/2020 – Changed the PowerShell to be more efficient, but now it doesn’t match the screenshots.

Comments

Link to PowerShell Script

This is a bundle of awesomeness Todd!!  Do you have a link to your updated PS script?
 on 7/16/2020 7:01 PM

Re: Link to PowerShell Script

The PowerShell is in the blog post. I updated it there. I'm thinking about writing it as a function in a module, but I haven't published that yet.

tk
Todd O. KlindtNo presence information on 7/19/2020 9:01 PM

Get-AdminFlow not returning expected value

Thanks Todd for the helpful article. When I am tying Get-AdminFlow, instead of the  flows, I am getting a bunch of {}{}{} followed by a lots  of empty lines scrolled. Account I am using is a Global Admin.

Soumya
 on 9/21/2020 11:14 AM

QuickBooks Support

Glad to visit your blog. Thanks for this great post that you share to us. For instant support related to the Quickbooks Payroll Problems please visit https://www.errorcodeexpert.com/five-ways-to-introduce-quickbooks-payroll-problems/ for instant help.
 on 10/20/2020 4:39 AM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 SysKit