Checking Unused Power Platform Apps using PowerShell

Loading

Unused Power Apps consume resources, increase maintenance efforts, and may pose security risks if left unmanaged. Automating the identification of inactive Power Apps using PowerShell ensures better governance and cost efficiency.

This guide covers:
Connecting to Power Platform using PowerShell
Retrieving a list of all Power Apps
Identifying unused Power Apps
Exporting the list to a CSV file for analysis
Automating the process using Windows Task Scheduler


Step 1: Prerequisites

1. Install Required PowerShell Modules

Ensure the necessary modules are installed:

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force
Install-Module -Name Microsoft.PowerApps.PowerShell -Force

2. Connect to Power Platform

Run the following command to authenticate:

Add-PowerAppsAccount

Now you are connected to Power Platform and can query apps.


Step 2: Retrieve All Power Apps

To list all Power Apps in the environment, use:

Get-AdminPowerApp | Select-Object DisplayName, AppName, Owner, CreatedTime, LastModifiedTime

This command retrieves all apps along with their metadata.


Step 3: Identify Unused Power Apps

To find apps that haven’t been modified in 90 days, use:

$inactiveDays = 90
$thresholdDate = (Get-Date).AddDays(-$inactiveDays)

$unusedApps = Get-AdminPowerApp | Where-Object { $_.LastModifiedTime -lt $thresholdDate }

$unusedApps | Select-Object DisplayName, AppName, Owner, LastModifiedTime |
Export-Csv -Path "C:\Unused_PowerApps.csv" -NoTypeInformation

Write-Output "Unused Power Apps list exported to C:\Unused_PowerApps.csv"

This exports the list of inactive Power Apps for review.


Step 4: Automate the Process Using Task Scheduler

To schedule automatic checks:

  1. Open Task Scheduler
  2. Click Create Basic Task
  3. Set a schedule (Weekly)
  4. Choose Start a ProgramPowerShell.exe
  5. Add script path: -File "C:\Scripts\Check_Unused_PowerApps.ps1"
  6. Click Finish

Now, PowerShell will automatically check for unused apps and export the results.

Leave a Reply

Your email address will not be published. Required fields are marked *