Hi @krishnanln !
Is it possible for you to try this:

Code:
@@copilotGeneratedAction: 'False'
Scripting.RunPowershellScript.RunPowershellScript Script: $'''# Install the required modules if not already installed
if (-not (Get-Module -ListAvailable -Name Microsoft.PowerApps.Administration.PowerShell)) {
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force -AllowClobber
}
if (-not (Get-Module -ListAvailable -Name Microsoft.PowerApps.PowerShell)) {
Install-Module -Name Microsoft.PowerApps.PowerShell -Force -AllowClobber
}
if (-not (Get-Module -ListAvailable -Name ImportExcel)) {
Install-Module -Name ImportExcel -Force -AllowClobber
}
# Import necessary modules
Import-Module Microsoft.PowerApps.Administration.PowerShell -Verbose
Import-Module Microsoft.PowerApps.PowerShell -Verbose
Import-Module ImportExcel''' ScriptOutput=> PowershellOutput3 ScriptError=> ScriptError3
@@copilotGeneratedAction: 'False'
Scripting.RunPowershellScript.RunPowershellScript Script: $'''# Function to handle errors
function Handle-Error {
param ($ErrorMessage)
Write-Host \"Error: $ErrorMessage\" -ForegroundColor Red
exit 1
}
try {
# Connect to Power Automate
Add-PowerAppsAccount
} catch {
Handle-Error \"Failed to connect to Power Automate: $_\"
}
try {
# List all environments
$environments = Get-AdminPowerAppEnvironment
$environments
# Get list of all flows in the specific environment
$environmentName = \'your-environment-name\' # Replace with the correct environment name
$flows = Get-AdminFlow -EnvironmentName $environmentName
if ($flows.Count -eq 0) {
Handle-Error \"No flows found in the environment $environmentName.\"
}
# Create a list to store flow details
$flowDetails = @()
foreach ($flow in $flows) {
# Get flow details
$flowId = $flow.FlowName
$flowName = $flow.DisplayName
# Get actions for each flow
$actions = Get-FlowRunAction -EnvironmentName $environmentName -FlowName $flowId -RunName (Get-FlowRuns -EnvironmentName $environmentName -FlowName $flowId | Select-Object -First 1).Name
foreach ($action in $actions) {
$actionDetails = @{
FlowName = $flowName
ActionName = $action.DisplayName
ActionType = $action.Name
}
$flowDetails += $actionDetails
}
}
} catch {
Handle-Error \"Failed to retrieve flows or actions: $_\"
}
try {
# Define the output file path
$outputFilePath = \"C:\\Users\\JohnDoe\\Desktop\\FlowsAndActions.xlsx\"
# Write the data to Excel
$flowDetails | Export-Excel -Path $outputFilePath -AutoSize
Write-Host \"Flow details exported to $outputFilePath\" -ForegroundColor Green
} catch {
Handle-Error \"Failed to export data to Excel: $_\"
}''' ScriptOutput=> PowershellOutput4 ScriptError=> ScriptError4
@@copilotGeneratedAction: 'False'
Scripting.RunPowershellScript.RunPowershellScript Script: $'''# List available cmdlets from the PowerApps modules
Get-Command -Module Microsoft.PowerApps.Administration.PowerShell
Get-Command -Module Microsoft.PowerApps.PowerShell''' ScriptOutput=> PowershellOutput5 ScriptError=> ScriptError5
Remember in the above code, just replace your environment name and the path of your excel file where you put on your machine.
Just remember before running this code, first run this following code in your PowerShell in Administrator mode:
# Install the required modules
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force -AllowClobber
Install-Module -Name Microsoft.PowerApps.PowerShell -Force -AllowClobber
Install-Module -Name ImportExcel -Force -AllowClobber
I have this excel file on my desktop:

Just attach screenshots if you get errors or any success.
Just let me know if this works. I hope this helps.