Introduction

In this blog, you will see as an administrator how to get all the flows that contain specific characters (for example, test) from a specific environment using PowerShell.

Prerequisites

Install the following modules.

  1. Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
  2. Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber

PowerShell Script

Open Notepad and paste the following script. Save the file as script.ps1.

  1. # Input Parameters
  2. $envDispName='Finance Prod'
  3. # This call opens prompt to collect credentials (Azure Active Directory account and password) used by the commands
  4. Add-PowerAppsAccount
  5. # Get the specific environment
  6. $env=Get-AdminPowerAppEnvironment -ErrorAction SilentlyContinue| Where-Object {$_.DisplayName -eq $envDispName}
  7. $envName=$env.EnvironmentName
  8. # Get all the flows from specific environment which contains the display name as test
  9. write-host -ForegroundColor Magenta "Getting flows from environment: " $env.DisplayName
  10. $flows=Get-AdminFlow *test* -EnvironmentName $envName
  11. # Loop through the flows and display teh values
  12. foreach($flow in $flows)
  13. {
  14. write-host -ForegroundColor Green "Flow Name: " $flow.FlowName " Display Name: " $flow.DisplayName " Created Time: " $flow.CreatedTime
  15. }

Open Windows PowerShell window and navigate to the location where the script file was saved.

Run the following command.

.\script.ps1

Reference

https://docs.microsoft.com/en-us/power-platform/admin/powerapps-powershell#power-automate-commands

Summary

In this blog, you saw how to get all the flows which contain specific characters from a specific environment using PowerShell.