# Install & Load Modules
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
set-executionpolicy bypass
Import-Module Microsoft.PowerApps.Administration.PowerShell
Import-Module Microsoft.PowerApps.PowerShell
# Login
Connect-AzureAD
Add-PowerAppsAccount
# Export All Flows to CSV
$exportFolderPath = "c:\OneDriveTemp\"
$flows = Get-AdminFlow
$flowExport = [System.Collections.ArrayList]@();
# Loop through all flows to expand on the user property.
foreach ($flow in $flows) {
$custFlow = New-Object -TypeName psobject
$custFlow | Add-Member -MemberType NoteProperty -Name FlowName -Value $flow.FlowName
$custFlow | Add-Member -MemberType NoteProperty -Name Enabled -Value $flow.Enabled
$custFlow | Add-Member -MemberType NoteProperty -Name DisplayName -Value $flow.DisplayName
$custFlow | Add-Member -MemberType NoteProperty -Name CreatedTime -Value $flow.CreatedTime
$custFlow | Add-Member -MemberType NoteProperty -Name EnvironmentName -Value $flow.EnvironmentName
$custFlow | Add-Member -MemberType NoteProperty -Name LastModifiedTime -Value $flow.LastModifiedTime
# Get the email of the user who created the flow.
try {
$user = Get-AzureADUser -ObjectId $flow.CreatedBy.userId
$custFlow | Add-Member -MemberType NoteProperty -Name CreatedBy -Value $user.Mail
} catch {
$custFlow | Add-Member -MemberType NoteProperty -Name CreatedBy -Value 'NOT FOUND IN AAD'
}
$flowExport.Add($custFlow) | Out-null
}
# Export to CSV.
$flowExport | Export-Csv -Path ($exportFolderPath + 'Flows1.csv') -Delimiter ',' -NoTypeInformation
# Other Commands
Get-AdminPowerAppEnvironment
Get-AdminPowerAppEnvironment –Default
Get-AdminPowerAppEnvironment –EnvironmentName 'EnvironmentName'
Get-AdminPowerApp
Get-AdminPowerApp 'DisplayName'
Get-AdminFlow
No comments:
Post a Comment