How to Use Get-EXOMailboxFolderStatistics in Powershell

5 min read James Futhey
Microsoft Learn documentation for the Get-EXOMailboxFolderStatistics cmdlet showing its PowerShell syntax

Exchange Online administrators often need to identify which mailbox folders consume the most storage, check item counts, or review calendar folders in room mailboxes.

The Get-EXOMailboxFolderStatistics cmdlet provides this information without requiring administrators to open individual mailboxes in Outlook. It can also retrieve archive mailbox statistics and generate reports across multiple mailboxes.

What Is the Get-EXOMailboxFolderStatistics Cmdlet?

Get-EXOMailboxFolderStatistics is an Exchange Online PowerShell cmdlet that retrieves folder-level mailbox statistics.

It returns information such as:

  • Folder names, paths, and IDs.
  • Folder sizes and combined subfolder sizes.
  • Item counts within individual folders.
  • Item counts across folders and their subfolders.
  • Statistics for Inbox, Calendar, Deleted Items, and other folder types.

Properties including ItemsInFolder, ItemsInFolderAndSubfolders, FolderSize, and FolderAndSubfolderSize can include hidden items used by applications. Consequently, reported item counts may differ from the messages visible in Outlook.

For administrators familiar with the older cmdlet, see our Get-MailboxFolderStatistics PowerShell guide. Microsoft recommends the EXO-prefixed cmdlet for Exchange Online.

Syntax

Get-EXOMailboxFolderStatistics
[-Identity <String>]
[-FolderScope <ElcFolderType>]
[-Archive]
[-IncludeOldestAndNewestItems]
[-PrimarySmtpAddress <String>]
[-UserPrincipalName <String>]
[-ExternalDirectoryObjectId <Guid>]
[-IncludeSoftDeletedRecipients]
[<CommonParameters>]

The syntax above shows the supported parameters relevant to administration. The omitted DiagnosticInfo parameter is deprecated in Exchange Online PowerShell module version 3.7.0-Preview1 and later.

Parameters

  • -Identity: Identifies the target mailbox using a UPN, alias, name, or another supported unique identifier. Wildcard characters are not supported.
  • -FolderScope: Limits results to a folder category. Valid values include All (the default), Inbox, Calendar, SentItems, DeletedItems, RecoverableItems, and Contacts.
  • -Archive: Retrieves statistics from the associated archive mailbox rather than the primary mailbox.
  • -IncludeOldestAndNewestItems: Requests the dates of the oldest and newest items in each returned folder.
  • -PrimarySmtpAddress: Identifies a mailbox by its primary SMTP email address.
  • -UserPrincipalName: Identifies a mailbox using its UPN, which may differ from its primary email address.
  • -ExternalDirectoryObjectId: Identifies the mailbox using its Microsoft Entra ID ObjectId (GUID).
  • -IncludeSoftDeletedRecipients: Includes soft-deleted mailboxes in the results. These are deleted mailboxes that are still recoverable.

The four mailbox identification parameters, Identity, PrimarySmtpAddress, UserPrincipalName, and ExternalDirectoryObjectId, are mutually exclusive. Specify only one per command.

Identity supports pipeline input by value and property name. The three alternative identifier parameters support pipeline input by property name only.

Get-EXOMailboxFolderStatistics vs. Get-EXOMailboxStatistics

Both cmdlets retrieve statistics, but they operate at different levels.

Cmdlet Information returned Common administrative use
Get-EXOMailboxFolderStatistics Folder names, item counts, folder sizes, and subfolder statistics Investigating individual folders and calendar storage
Get-EXOMailboxStatistics Mailbox-level storage and item statistics Reviewing overall mailbox usage and storage consumption

Use Get-EXOMailboxStatistics to assess overall mailbox size. Use Get-EXOMailboxFolderStatistics to identify which folders contribute to that usage.

Practical Uses

1. Investigating Mailbox Storage

When a mailbox uses substantial storage, folder statistics help identify where the data resides.

Administrators can compare Inbox, Sent Items, Deleted Items, and individual folder sizes to identify unusually large folders. Combined folder and subfolder statistics help assess entire folder hierarchies.

2. Reviewing Calendar Folders in Room Mailboxes

Resource mailboxes store calendar information used for meeting room reservations.

Using FolderScope Calendar, administrators can review calendar folder item counts and storage usage in these mailboxes. This is useful for examining accumulated calendar data, but folder statistics alone cannot identify future reservations, booking conflicts, or room availability.

3. Auditing Archive Mailboxes

Organizations using Exchange Online archiving can retrieve folder statistics from archive mailboxes separately from primary mailboxes.

These results help administrators compare archived folder sizes and item counts or produce storage reports for selected users.

Prerequisites

Before running the cmdlet, you need the Exchange Online PowerShell module, appropriate Exchange Online permissions, and access to the target mailbox's statistics.

Install the module if necessary:

Install-Module ExchangeOnlineManagement -Scope CurrentUser

Connect to Exchange Online:

Connect-ExchangeOnline -UserPrincipalName james@meetingroom365.com

Authenticate with an account authorized to run the cmdlet. The mailbox identifier used in subsequent examples does not have to be the administrator's sign-in address.

How to Use Get-EXOMailboxFolderStatistics: 8 Practical Examples

1. View All Folder Statistics for a Mailbox

Command:

Get-EXOMailboxFolderStatistics -Identity james@meetingroom365.com

This returns folder statistics for James's mailbox, including folder names, item counts, and storage information.

Because FolderScope is omitted, the command uses the default All scope.

2. Display Folder Names, Item Counts, and Sizes

Command:

Get-EXOMailboxFolderStatistics -Identity james@meetingroom365.com |
Select-Object Name, ItemsInFolder, FolderSize, FolderAndSubfolderSize

This displays four useful properties instead of the complete output.

FolderSize reports the folder's size, while FolderAndSubfolderSize includes its subfolders. ItemsInFolder reports the number of items in the individual folder.

3. Check Calendar Folder Statistics

Command:

Get-EXOMailboxFolderStatistics `
-Identity simon@meetingroom365.com `
-FolderScope Calendar |
Select-Object Name, ItemsInFolder, FolderSize

This limits results to calendar folders.

The same approach works with a room mailbox's email address, allowing administrators to review calendar folder storage and item counts without opening its calendar.

The results do not directly indicate how many upcoming meetings are scheduled.

4. Find the Largest Mailbox Folders

Command:

Get-EXOMailboxFolderStatistics -Identity james@meetingroom365.com |
Sort-Object -Property @{
Expression = {
$size = [string]$_.FolderSize
if ($size -match '\(([\d,]+) bytes\)') {
[int64]($Matches[1] -replace ',', '')
} else {
0
}
}
} -Descending |
Select-Object -First 10 Name, FolderPath, FolderSize

This identifies the ten largest individual folders.

The calculation extracts the numeric byte count from the commonly returned English-language size string, avoiding incorrect alphabetical sorting of values such as MB and GB.

Note: This example assumes FolderSize contains an English-language byte count in parentheses. Check the returned format before using it with other locales or output formats.

5. View Archive Mailbox Folder Statistics

Command:

Get-EXOMailboxFolderStatistics `
-Identity james@meetingroom365.com `
-Archive |
Select-Object Name, ItemsInFolder, FolderSize

The Archive switch retrieves folder statistics from James's associated archive mailbox.

If the mailbox does not have archiving enabled, Exchange Online returns an error.

The Archive switch is different from FolderScope Archive, which selects a folder category.

6. Retrieve Folder Statistics Including Oldest and Newest Item Dates

Command:

Get-EXOMailboxFolderStatistics `
-Identity james@meetingroom365.com `
-FolderScope Calendar `
-IncludeOldestAndNewestItems

This retrieves calendar folder statistics and requests the dates of the oldest and newest items.

These dates can help administrators assess the time span of stored calendar data.

7. Retrieve Inbox Folder Statistics Across Multiple Mailboxes

Command:

Get-EXOMailbox -ResultSize Unlimited |
Get-EXOMailboxFolderStatistics -FolderScope Inbox |
Select-Object Identity, ItemsInFolderAndSubfolders, FolderAndSubfolderSize

This uses the documented pipeline approach to retrieve Inbox folder statistics across all mailboxes returned by Get-EXOMailbox.

It is useful for tenant-wide reporting, although large tenants may generate substantial output and require significant execution time.

8. Export Folder Statistics to CSV

Command:

$mailboxes = @(
"james@meetingroom365.com",
"simon@meetingroom365.com"
)
$report = foreach ($mailbox in $mailboxes) {
Get-EXOMailboxFolderStatistics -Identity $mailbox |
Select-Object @{Name="Mailbox";Expression={$mailbox}},
Name, FolderPath, ItemsInFolder, FolderSize
}
$report | Export-Csv -Path ".\MailboxFolderReport.csv" -NoTypeInformation

This generates a CSV report containing folder names, paths, item counts, and sizes for two mailboxes.

The calculated Mailbox column associates every folder record with its originating mailbox, making the report suitable for combining statistics from multiple users.

Common Problems and Limitations

  • Archive not enabled: Using -Archive without an associated enabled archive produces an error.
  • Null or nonexistent mailbox identifiers: Microsoft warns that a $null or nonexistent Identity value can return all objects as though Identity were omitted. Validate identifiers before bulk processing.
  • Incorrect scope: FolderScope accepts documented folder categories, not arbitrary folder paths.
  • Unexpected item counts: Hidden application items may contribute to reported item counts and sizes.
  • Unsupported wildcards: The Identity parameter does not support wildcard characters.
  • Mailbox-level reporting: Use Get-EXOMailboxStatistics for overall mailbox statistics rather than relying on individual folder results.
  • Permissions: This cmdlet does not retrieve folder-level delegated permissions or change mailbox access. It also cannot export Teams chats or message contents.
  • Large bulk queries: Tenant-wide reports can return many folder records. Limit the mailbox selection or folder scope when possible.

Final Note

Get-EXOMailboxFolderStatistics is appropriate when administrators need individual folder sizes, item counts, calendar folder statistics, or archive folder reports.

For overall mailbox storage, use Get-EXOMailboxStatistics. For identifying where mailbox data is stored, the folder-level cmdlet provides the more relevant information.

Add a display to your office

Every room, on the door.

Live availability on every meeting room. Works with Microsoft 365, Exchange and Google Workspace.