/
/

How to Get Mailbox Size Reports with PowerShell at Scale

by Mikhail Blacer, IT Technical Writer
How to Get Mailbox Size Reports with PowerShell at Scale blog banner image

Instant Summary

This NinjaOne blog post offers a comprehensive basic CMD commands list and deep dive into Windows commands with over 70 essential cmd commands for both beginners and advanced users. It explains practical command prompt commands for file management, directory navigation, network troubleshooting, disk operations, and automation with real examples to improve productivity. Whether you’re learning foundational cmd commands or mastering advanced Windows CLI tools, this guide helps you use the Command Prompt more effectively.

Key Points

  • Collect Authoritative Mailbox Data: Run Get-MailboxStatistics in PowerShell to capture mailbox size, item counts, and last logon details directly from Exchange Online.
  • Include Quota and Archive Info: Combine mailbox statistics with Get-EXOMailbox to surface quota limits, archive usage, and overall storage footprint.
  • Target Folder Sampling for Large Mailboxes: Run Get-MailboxFolderStatistics on oversized or high-risk mailboxes to identify growth sources or retention issues.
  • Normalize and Export Consistently: Convert sizes to GB, add metadata (tenant, timestamp, script version), and export to CSV or JSON for easy trend tracking.
  • Automate at Scale with Safeguards: Use app-only auth, throttling control, and retry logic for unattended jobs across large or multi-tenant environments.

Mailbox size reports can help MSPs drive capacity planning, restore validation, and investigation timelines across Exchange Online environments. PowerShell provides direct, server-side metrics that reveal true mailbox size, item count, and archive usage without relying on client views.

This guide shows how to use Get-Mailboxstatistics and related Exchange Online cmdlets to produce accurate Office 365 mailbox size reports with PowerShell at scale for MSPs. This gives you information about how to include quote data, archive context, and folder-level sampling, then normalize results for automation, audits, and monthly QBRs.

Steps for getting Mailbox size reports with PowerShell at scale

Mailbox size reporting should pull server-side stats and quota context directly from Exchange Online. These reports will also support migration planning, enabling teams to exchange online mailbox migrations without downtime.

📌 Prerequisites:

  • You will need the Exchange Online (EXO) PowerShell module and permissions to read mailbox properties and statistics.
  • This requires secure credential storage or app-only authentication configured for unattended runs.
  • You will need a central path where CSV, JavaScript Object Notation (JSON), and run logs are written consistently.
  • This requires an optional list of target mailboxes for folder-level sampling during deeper analysis.

Step 1: Inventory mailbox sizes efficiently

Start by gathering mailbox statistics from Exchange Online to establish a clean reporting baseline. This step helps you capture size metrics and mailbox types for future quota, archive, and growth analysis.

📌 Use Cases:

  • This creates an authoritative baseline using Get-MailboxStatistics for audits, QBRs, or tenant migrations.
  • Distinguishes between user, shared, and resource mailboxes to support accurate quota and capacity planning.

📌 Prerequisites:

  • You will need the Exchange Online PowerShell (EXO V3) module installed and have access to run mailbox statistics commands.
  • This requires admin credentials or app-only authentication to connect securely to Exchange Online.

Step-by-step process:

  1. Connect to Exchange Online PowerShell.
  2. Run Get-MailboxStatistics and select only required fields such as TotalItemSize, ItemCount, LastLogonTime, and Database.
  3. Export results to CSV or JSON format as a baseline.
  4. Include a column for mailbox type to separate user, shared, and resource mailboxes.
  5. Store the export in a central location for comparison in later runs.

Step 2: Add quota and archive context

Enhance the baseline report by combining mailbox statistics with quota and archive details. This will provide visibility into storage usage, potential breaches, and the true mailbox footprint across the tenant.

📌 Use Cases:

  • This helps identify users who are nearing quota limits or have exceeded thresholds.
  • It provides full visibility into Exchange Online mailbox sizes by including archive mailbox data alongside primary storage.

📌 Prerequisites:

  • You will need additional permissions to query mailbox properties using the Get-EXOMailbox cmdlet.
  • This needs access to both mailbox statistics and property data to perform merges in PowerShell.

PowerShell command:

Get-EXOMailbox | 

Select-Object DisplayName, IssueWarningQuota, ProhibitSendQuota, ArchiveStatus

This retrieves quota and archive information from Exchange Online mailboxes to combine with Get-MailboxStatistics outputs for complete storage reporting.

Step 3: Optional folder-level sampling for depth

Folder-level sampling provides insight into mailbox growth patterns and helps explain why certain mailboxes consume more storage than expected.

📌 Use Cases:

  • Analyzes which folders contribute most to mailbox size growth for accurate reporting and forecasting.
  • Supports investigations into abnormal storage use, recovery folder buildup, or quota breaches.

📌 Prerequisites:

  • You will need advanced rights to run Get-MailboxFolderStatistics across target mailboxes.
  • This requires a baseline export that identifies the largest or most critical mailboxes.

PowerShell command:

$largest = (Import-Csv .\MailboxSize_Baseline.csv |

Sort-Object TotalItemSize -Descending |

Select-Object -First 20 -ExpandProperty Mailbox)

$null = New-Item -ItemType Directory -Path .\FolderSamples -Force

foreach ($mbx in $largest) {

$top = Get-MailboxFolderStatistics -Identity $mbx -FolderScope All |

Select-Object FolderPath, ItemsInFolder, FolderSize |

Sort-Object ItemsInFolder -Descending |

Select-Object -First 10

$ri = Get-MailboxFolderStatistics -Identity $mbx -FolderScope RecoverableItems |

Select-Object FolderPath, ItemsInFolder, FolderSize

$top | Export-Csv ".\FolderSamples\$($mbx)_TopFolders.csv" -NoTypeInformation

$ri | Export-Csv ".\FolderSamples\$($mbx)_RecoverableItems.csv" -NoTypeInformation

}

This command samples folder statistics from the largest mailboxes, capturing top folders and recoverable items to pinpoint growth sources and retention impact.

Step 4: Normalize, label, and store outputs

Normalizing mailbox size data creates consistent, comparable reports across tenants and reporting cycles.

📌 Use Cases:

  • This converts mailbox size data to standardized units for accurate trend analysis.
  • This lets you add metadata for audit tracking and dashboard integration.

📌 Prerequisites:

  • You will need previous CSV or object data from earlier steps.
  • This needs PowerShell environment access to manipulate and export CSV/JSON files.

PowerShell command:

$report = Import-Csv .\MailboxSize_Joined.csv | ForEach-Object {

[pscustomobject]@{

DisplayName = $_.DisplayName

Mailbox = $_.Mailbox

MailboxType = $_.MailboxType

TotalItemSizeGB = [math]::Round(($_.TotalItemSize -replace '.*\((.*?)\sbytes\).*','$1')/1GB,2)

PercentQuotaUsed= $_.PercentQuotaUsed

AsOf = (Get-Date).ToString('yyyy-MM-dd')

TenantId = 'ContosoTenant'

ScriptVersion = 'v1.0'

}

}

$report | Export-Csv ".\MailboxSize_Normalized.csv" -NoTypeInformation

$report | ConvertTo-Json | Out-File ".\MailboxSize_Normalized.json"

This script converts mailbox sizes to gigabytes, adds labels for date, tenant, and script version, and exports the data to CSV and JSON for reporting or dashboards.

Step 5: Automate with safeguards

Automation ensures mailbox size reports run consistently without user interaction, minimizing throttling and transient fault risks across large Office 365 tenants.

📌 Use Cases:

  • Enables unattended report generation across multiple tenants or environments.
  • Provides reliable Exchange Online mailbox size monitoring with retry logic and versioned delta tracking.

📌 Prerequisites:

  • You will need app-only authentication configured in Azure AD for noninteractive Exchange Online sessions.
  • This needs a secure script repository and task scheduler to handle nightly or weekly runs.
Connect-ExchangeOnline -AppId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" `

-CertificateThumbprint "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" `

-Organization "contoso.onmicrosoft.com"

for ($i=0; $i -lt 3; $i++) {

try {

.\Get-MailboxSizeReport.ps1

break

} catch {

Start-Sleep -Seconds (30 * ($i + 1))

}

}

Compare-Object (Import-Csv .\MailboxSize_Previous.csv) (Import-Csv .\MailboxSize_Current.csv) |

Export-Csv .\MailboxSize_Delta.csv -NoTypeInformation

This PowerShell step connects securely, applies retry logic to avoid throttling, and generates a delta comparison file for tracking mailbox growth and quota changes across reporting cycles.

Step 6: Multi-tenant rollups for MSPs

Rollups let MSPs combine results from multiple tenants into a single report for comparative analysis of client reviews.

📌 Use Cases:

  • This produces a single dashboard showing the largest mailboxes, quota breaches, and archive usage by tenant.
  • It simplifies QBR preparation by consolidating per-tenant outputs into a single, normalized dataset.

📌 Prerequisites:

  • You will need an existing tenant configuration file that defines authentication details per tenant.
  • This requires all previous reporting steps to be completed successfully and for their exports to be stored in a central location.

What to do:

  • Loop tenants from a configuration file and authenticate per-tenant.
  • Write each tenant’s output into its own folder with a consistent date stamp.
  • Generate a combined rollup that shows the largest mailboxes, growth trends, quota breaches, and archive adoption across all tenants.

Step 7: Turn mailbox reports into measurable outcomes

Converting mailbox size data into follow-up tasks will ensure that the data leads to measurable outcomes.

📌 Use Cases:

  • This opens proactive tickets for quota breaches, abnormal growth, or oversized shared mailboxes.
  • It highlights monthly trends and exceptions in QBRs to demonstrate the maturity of capacity planning.

📌 Prerequisites:

  • You will need the mailbox size and quota reports completed from the previous steps.
  • To accomplish this step, you will need access to your PSA software or service desk to open and track remediation tickets.

What to do:

  • Create tickets for high PercentQuotaUsed values, rapid mailbox growth, or oversized shared mailboxes.
  • Attach relevant mailbox samples to restore or retention tests for verification.
  • Include growth charts, quota breaches, and archive trends in monthly QBR packets to close the reporting loop.

⚠️ Things to look out for

Risks

Potential Consequences

Reversals

Missing authentication context in scheduled jobsAutomation fails silently or produces incomplete reports.Use app-only authentication and test token validity before scheduling
Large exports without normalizationReport comparisons and trends become unreliableConvert all mailbox sizes to GB and include consistent metadata fields
Incomplete or skipped tenant runsRollup shows inconsistent totals or missing tenantsValidate per tenant folders and record counts before compiling final reports

Best practices summary table for obtaining mailbox size reports on PowerShell

Practice

Purpose

Value Delivered

Mailbox size baselineCapture authoritative mailbox metrics with Get-MailboxStatisticsAccurate capacity data for forecasting and audits
Include quota and archive detailsCombine usage data with quota thresholds and archive status for full visibilityBetter capacity planning and fewer unexpected storage breaches
Folder-level samplingAnalyze folder statistics for large, fast-growing mailboxesQuicker root-cause detection and improved retention management
Normalize and label outputsStandardize mailbox data across tenants with consistent units and metadataEasy comparisons, reliable trend analysis, and dashboard integration
Automate reporting securelyUse app-only authentication and scheduled scripts for recurring jobsScalable, secure, and consistent multi-tenant reporting

Tasks to help streamline mailbox size reporting and quota tracking

Using automation and accomplishing these tasks ensures mailbox size reports stay consistent, accurate, and ready for audits or QBRs.

  • Schedule a PowerShell job to export mailbox size and item counts with Get-MailboxStatistics.
  • Merge quota details from Get-EXOMailbox and calculate PercentQuotaUsed to track usage and growth.
  • Flag quota breaches and large-growth anomalies automatically in each run.
  • Optionally sample folder statistics for the top 50 mailboxes to identify storage-heavy folders.
  • Export CSV, JSON, and a summary log including record counts, runtime, and applied filters.
  • Run a monthly comparison task to create delta reports and a one-page summary for documentation.

Scaling mailbox size reporting for MSP operations

Mailbox size reporting becomes a strategic process when Exchange Online PowerShell cmdlets are combined with quota and archive context, targeted folder sampling, and automation. Normalized outputs and monthly deltas provide a clear view of capacity trends and storage utilization across tenants.

By utilizing Get-MailboxStatistics and structured PowerShell mailbox size reports, MSPs can transform raw data into actionable planning insights, incident evidence, and QBR-ready summaries. This approach fosters operational consistency, minimizes surprises, and enables informed capacity and retention decisions across all client environments.

Related topics:

FAQs

In Exchange Online, your reports include the complete mailbox and archive data, covering recoverable items and retained content, even if these aren’t visible in your standard view.

You should use app‑only authentication with retry logic and secure credential storage. Try scheduling recurring jobs and generating delta comparisons to track changes between runs.

Only when investigating unusually large mailboxes or retention issues. Sampling every mailbox increases runtime without improving visibility.

At minimum: mailbox name, type, size in GB, percent of quota used, archive status, and timestamp. Consistent units make month-to-month comparisons reliable.

Size trends, quota breaches, and archive adoption metrics demonstrate proactive capacity management and support SLA and compliance evidence.

You might also like

Ready to simplify the hardest parts of IT?