Get All PowerApps By Owner Using PowerShell
Clear-Host
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
Set-Location -Path $scriptPath
#Add-PowerAppsAccount
$users = Get-AdminPowerApp | Select –ExpandProperty Owner | Select –ExpandProperty displayname | Group | Sort-Object -Property @{Expression = "Count"; Descending = $True}
$appsByOwnerFilePath = "$scriptPath\AppsByOwner.csv"
Remove-Item $appsByOwnerFilePath
$appsByOwnerHeaders = "User,App Count";
Add-Content -Path $appsByOwnerFilePath -Value $appsByOwnerHeaders
foreach ($user in $users) {
$name = $user.Name -replace ',',';'
Add-Content -Path $appsByOwnerFilePath -Value ($name + ',' + $user.Count)
}
No comments:
Post a Comment