Skip to main content

Notifications

Power Automate - General Discussion
Suggested answer

Export All cloud flows in my organization with last execution time

(1) ShareShare
ReportReport
Posted on by 2
I have to check the last execution time of all the cloud flows in my organization. Currently, I can use "Get-Adminflow" command in PowerShell to export all flows in my org. However, the output of this command only show columns like FlowName, CreateTime, CreateBy that can't meet my requirement. Due to this issue, I use another PowerShell command, Get-FlowRun, to retrieve the last execution record of every flow in my org. However, after I use this command, I can only see the last execution time and status of the flows that I owe and others share with me, other flows of these two columns remain empty.
Besides, I have the Power Platform administrator authority and Power Automate Premium for my account
Is there any suggestion that how can I fix this issue? Thanks a lot.
 
My PowerShell command:
Import-Module Microsoft.PowerApps.Administration.PowerShell
Connect-AzureAD
Add-PowerAppsAccount
$flows = Get-AdminFlow
$detailedFlows = @()
foreach ($flow in $flows) {
    $ADUser = $null
    try {
        $ADUser = (Get-AzureADUser -ObjectId $flow.CreatedBy.userId)
    }
    catch {
        Write-Warning "User not found for ObjectId: $($flow.CreatedBy.userId)"
    }
    if ($ADUser) {
        $lastRun = (Get-FlowRun -EnvironmentName $flow.EnvironmentName -FlowName $flow.FlowName | Sort-Object -Property StartTime -Descending | Select-Object -First 1)
        $detailedFlows += [PSCustomObject]@{
            flowName = $flow.DisplayName
            creatorID = $ADUser.UserPrincipalName.Substring(0, 6)
            creatorName = $ADUser.DisplayName
            creatorDept = $ADUser.Department
            modifiedTime = $flow.LastModifiedTime
            lastExecutionTime = $lastRun.StartTime
            status = $lastRun.Status
            enable = $flow.Enabled
        }
    }  
}
$detailedFlows | Export-Csv -Path "../flow_detail.csv" -Encoding UTF8
Categories:
  • Suggested answer
    ankit_singhal Profile Picture
    ankit_singhal 365 on at
    Export All cloud flows in my organization with last execution time
    You should use any service account for this activity. Service account should be owner of all flow or you can share all flow with you as well if there is no impact.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,422

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,711

Leaderboard