Powershell Script : Microsoft Teams app installation report for all Teams

In this blog post, We will  be walking  through , how to use PowerShell to generate a Microsoft Teams app installation report for all teams within your tenant.

Please Note : This script not tested in a large environment , It may  get throttled on your servers which you running in the big organisations.Depending on your environment, the running time and output file size differs.

 In this script, we need to connect Microsoft teams powershell first 

 we’ll use two foreach loops and specify the output. The first loop enumerates through each team and uses the Get-TeamsAppInstallation cmdlet to get all installed apps in the team. The second loop enumerates through the installed apps and builds the output of the report. The output will create the file "C:\Temp\TeamsAppInstallationReport.csv" and append the details of each installed app to the file as the script enumerates through the teams and the installed apps.

Connect-MicrosoftTeams

$AllTeams = Get-Team

foreach ($Team in $AllTeams) {
    # Get the installed apps for $Team
    $InstalledApps = Get-TeamsAppInstallation -TeamId $Team.GroupId
     
    # Enumerate through each $InstalledApp and create a PSCustomObject containing the $Team details and $InstalledApp details.
    foreach ($InstalledApp in $InstalledApps) {
        $Output = [PSCustomObject]@{
            GroupId                 = $Team.GroupId
            TeamDisplayName         = $Team.DisplayName
            DisplayName             = $InstalledApp.DisplayName
            Version                 = $InstalledApp.Version
            Id                      = $InstalledApp.Id
            TeamsAppDefinitionId    = $InstalledApp.TeamsAppDefinitionId
            TeamsAppId              = $InstalledApp.TeamsAppId
        }
 
        $Output | Export-Csv -Path "C:\Temp\TeamsAppInstallationReport.csv" -Append -NoTypeInformation
    }
}

Sample Output :




Happy Learning 😊

Comments