Skip to main content

Statistic helpers

For full parameter descriptions and up-to-date notes, run Get-Help Export-MboxStatistics -Detailed or Get-Help Get-MboxStatistics -Detailed.

Export-MboxStatistics

Export mailbox statistics (size, quotas, archive info) either to CSV (all mailboxes) or as objects (single mailbox).

Syntax

Export-MboxStatistics [-UserPrincipalName <String>] [-CsvFolder <String>] [-Round] [-BatchSize <Int>]
ParameterTypeDescriptionRequiredDefault
UserPrincipalNameStringOptional single mailbox identity; when omitted, all mailboxes are exported to CSV.No-
CsvFolderStringOutput folder (for all-mailbox export).NoCurrent directory
RoundSwitchRound quota values up to the nearest integer GB.NoFalse
BatchSizeIntFlush to CSV every N mailboxes.No25

Examples

# Export every mailbox to CSV (batched writes)
Export-MboxStatistics -CsvFolder 'C:\Temp\Reports' -Round

# Inspect a single mailbox as objects
Export-MboxStatistics -UserPrincipalName 'user@contoso.com'

Get-MboxStatistics

Return a simplified mailbox statistics view as objects.

Syntax

Get-MboxStatistics [-UserPrincipalName <String>] [-IncludeArchive] [-IncludeMessageActivity] [-Round]
ParameterTypeDescriptionRequiredDefault
UserPrincipalNameStringOptional mailbox identity (also from pipeline, including multiple values); when omitted, all mailboxes are returned.No-
IncludeArchiveSwitchInclude archive size and usage info when archive is enabled.NoFalse
IncludeMessageActivitySwitchInclude message activity fields (LastReceived, LastSent, OldestItemReceivedDate, OldestItemFolderPath).NoFalse
RoundSwitchRound quota values up to the nearest integer GB.NoTrue

Output (main fields)

  • DisplayName
  • UserPrincipalName
  • PrimarySmtpAddress
  • MailboxTypeDetail
  • ArchiveEnabled
  • MailboxSizeGB
  • ItemCount
  • MailboxCreated
  • LastLogonTime
  • WarningQuotaGB
  • ProhibitSendQuotaGB
  • PercentUsed
  • LastReceived (only with -IncludeMessageActivity)
  • LastSent (only with -IncludeMessageActivity)
  • OldestItemReceivedDate (only with -IncludeMessageActivity)
  • OldestItemFolderPath (only with -IncludeMessageActivity)
  • ArchiveSizeGB (only with -IncludeArchive)
  • ArchivePercentUsed (only with -IncludeArchive)

Examples

# Quick glance at a single mailbox
Get-MboxStatistics -UserPrincipalName 'user@contoso.com'

# Include archive data
Get-MboxStatistics -UserPrincipalName 'user@contoso.com' -IncludeArchive

# Include message activity (latest trace + oldest item details)
Get-MboxStatistics -UserPrincipalName 'user@contoso.com' -IncludeMessageActivity

# Multiple mailboxes from pipeline
'user1@contoso.com','user2@contoso.com','user3@contoso.com' | Get-MboxStatistics -IncludeArchive

# All mailboxes (may take a while due to message trace queries)
Get-MboxStatistics -IncludeMessageActivity