Skip to main content

Posts

Showing posts from November, 2022

Power Platform Audit Scripts using PowerShell -All Environments

Get All Environments using PowerShell   Clear-Host $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition $environmentsFilePath = "$scriptPath\Environments.xlsx" $excel = New-Object -ComObject excel.application  $workbook = $excel.Workbooks.Add() $envs = Get-AdminPowerAppEnvironment $wksht= $workbook.Worksheets.Add()  $wksht.Name = 'Environments' $wksht.Cells.Item(1,1) = "EnvironmentName" $wksht.Cells.Item(1,2) = "DisplayName" $wksht.Cells.Item(1,3) = "UniqueName" $wksht.Cells.Item(1,4) = "EnvironmentType" $wksht.Cells.Item(1,5) = "CommonDataServiceDatabaseType" $wksht.Cells.Item(1,6) = "IsDefault" $wksht.Cells.Item(1,7) = "Location" $wksht.Cells.Item(1,8) = "AzureRegion" $wksht.Cells.Item(1,9) = "MetadataType" $wksht.Cells.Item(1,10) = "InternalCds" $wksht.Cells.Item(1,11) = "CreatedBy" $wksht.Cells.Item(1,12) = "CreatedTime" $wksht.Cel...

Power Platform Audit Scripts using PowerShell -All PowerApps

Get All Power Apps using PowerShell  Clear-Host Install-Module -Name Microsoft.PowerApps.Administration.PowerShell Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber  #Import-Module (Join-Path (Split-Path $script:MyInvocation.MyCommand.Path) "Microsoft.PowerApps.Administration.PowerShell.psm1") -Force Add-PowerAppsAccount $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition Set-Location -Path $scriptPath $AppRoleAssignmentsFilePath = ".\AppsDetails.csv" # Add the header to the app roles csv file $appRoleAssignmentsHeaders = "EnvironmentName," `         + "AppName," `         + "AppDisplayName," `         + "SharedUsers," `         + "SharedGroups," `         + "CreatedTime," `         + "LastModifiedTime," `         + "AppOwnerObjectId," `         + "AppOwnerDisplayName," `     ...

Power Platform Audit Scripts using PowerShell -All PowerApps Summary

 Get all Power Apps by Summary Clear-Host #Install-Module -Name Microsoft.PowerApps.Administration.PowerShell #Add-PowerAppsAccount $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition Set-Location -Path $scriptPath $AppRoleAssignmentsFilePath = ".\Apps.csv" try { Remove-Item $AppRoleAssignmentsFilePath } catch{} # Add the header to the app roles csv file $appRoleAssignmentsHeaders = "EnvironmentName," `         + "AppName," `         + "AppDisplayName," `         + "Description," `         + "AppType," `         + "UsesOnPremiseGateway," `         + "UsesPremiumApi," `         + "UsesCustomApi," `         + "SharedUsers," `         + "SharedGroups," `         + "SharedWithTenant," `         + "CreatedTime," `         + "LastModifi...

Power Platform Audit Scripts using PowerShell -All PowerApps By Owner

 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) }