🔧 New: User Management Graph PowerShell Toolkit

Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.

🚀 Launch Toolkit

Generate Teams Activity Reports Using Graph PowerShell (Get-MgReportTeamActivityCount)

Keeping track of collaboration trends in Microsoft Teams is vital for every Microsoft 365 administrator. Whether it’s monitoring how active your departments are, identifying inactive Teams, or reviewing adoption growth — Microsoft Graph PowerShell gives you a direct way to pull these insights.

In this article, we’ll explore the Get-MgReportTeamActivityCount cmdlet — your go-to tool for exporting Teams activity metrics without ever opening the admin center.


What Does This Report Show?

The Get-MgReportTeamActivityCount cmdlet generates Teams activity reports for a given time period.

You can retrieve metrics such as:

  • Active Channels and Active Channel Users count
  • Messages sent count
  • Meetings replied count
  • Mentions count
  • Reactions and channel messages count

It’s a perfect fit for IT admins who want quick visibility into collaboration trends or need monthly usage summaries.


Prerequisites

Before running the cmdlet, make sure you’ve got the right setup.

  • Install & update the Graph module
    Install-Module Microsoft.Graph -Scope CurrentUser
    Update-Module Microsoft.Graph
    
  • Connect to Microsoft Graph with the required permissions
    Connect-MgGraph -Scopes "Reports.Read.All"
  • Note these key rules
    • The -Period parameter can’t exceed 180 days.
    • The -OutFile parameter is mandatory (the report must be exported to a file).
    • Available period values include: D7, D30, D90, and D180.

Cmdlet Syntax

Get-MgReportTeamActivityCount -Period <String> -OutFile <String>
  • -Period → Defines how many days of data you want (e.g., D7 = last 7 days).
  • -OutFile → The CSV file path where the report will be saved.

Usage Examples

Example 1: Export Teams activity for the last 7 days

Get-MgReportTeamActivityCount -Period "D7" -OutFile ".\TeamsActivity_D7.csv"
This gives you a quick look at the most recent activity patterns — great for weekly reporting.

Example 2: Export Teams activity for the last 30 days

Get-MgReportTeamActivityCount -Period "D30" -OutFile ".\TeamsActivity_D30.csv"
Ideal for monthly summaries or adoption tracking reports.

Example 3: Export data for the last 180 days (maximum allowed)

Get-MgReportTeamActivityCount -Period "D180" -OutFile ".\TeamsActivity_D180.csv"
Use this for half-year trend analysis or management reports.

Example 4: Compare growth between two reporting periods

You can combine two CSV exports to see how Teams activity evolved.


    $D30 = Import-Csv .\TeamsActivity_D30.csv
    $D180 = Import-Csv .\TeamsActivity_D180.csv

    $comparison = foreach ($team in $D180) {
    $recent = $D30 | Where-Object { $_.ReportDate -eq $team.ReportDate }
    if ($recent) {
        [pscustomobject]@{
            ReportDate = $team.ReportDate
            ActiveTeamsChange = [int]$recent.ActiveTeams - [int]$team.ActiveTeams
            MessageChange = [int]$recent.TeamChatMessages - [int]$team.TeamChatMessages
        }
    }
    }
    $comparison | Format-Table -AutoSize

Pro Tips

  • Stick to allowed periods : Anything above 180 days (D270, for instance) triggers an error.
  • Run off-peak : For large tenants, exporting reports may take a few minutes.
  • Visualize the data : Load the CSV into Excel or Power BI for graphs and trends.
  • Automate the task : Combine it with Task Scheduler or Azure Automation to generate monthly reports automatically.

Possible Errors & Solutions

Error Cause Solution
Period is out of allowed range You used a value greater than 180 days Use only D7, D30, D90, or D180
Insufficient privileges to complete the operation You didn’t connect with the right permission Reconnect with Connect-MgGraph -Scopes "Reports.Read.All".
Access denied / Forbidden Conditional Access or tenant restrictions Try with a global admin account or from an approved network
CSV empty or missing expected columns Data latency or no activity in the selected range Retry with a longer period like D30 or D90

Real-World Use Cases

  • IT Managers: Monitor how actively Teams are used across departments.
  • Adoption Specialists: : Track engagement after training sessions or rollouts.
  • Compliance Auditors: Identify inactive or underutilized Teams.
  • Leadership Dashboards: Combine with mailbox reports for unified communication insights.

Conclusion

The Get-MgReportTeamActivityCount cmdlet provides a quick and reliable way to understand how Teams is being used in your organization — no GUI required.

With just a few lines of PowerShell, you can automate collaboration reporting, compare growth periods, and visualize user engagement trends directly from the exported CSV.

By pairing this with other reporting cmdlets like Get-MgReportMailboxUsageDetail and Get-MgReportM365AppUserCount, you’ll have a complete 360° view of Microsoft 365 usage.


Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.

Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.

© Your Site Name. All Rights Reserved. Design by HTML Codex