Skip to main content

Statistic helpers

For full details and examples, 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'

Export-MboxDeletedItemSize

Export deleted item store usage for user mailboxes. The report is exported to CSV by default.

Syntax

Export-MboxDeletedItemSize [[-UserPrincipalName] <String[]>] [-CsvFolder <String>] [-Csv]
ParameterTypeDescriptionRequiredDefault
UserPrincipalName (User, Identity, Mailbox, SourceMailbox)String[]Optional mailbox identity or identities. When omitted, all user mailboxes are scanned. Pipeline accepted.No-
CsvFolderStringDestination folder for the CSV file.NoCurrent directory
CsvBooleanExport the report to CSV. Use -Csv:$false to return objects instead.NoTrue

Examples

# Export all user mailboxes to CSV
Export-MboxDeletedItemSize
# Export a subset of mailboxes to a custom folder
'user1@contoso.com','user2@contoso.com' | Export-MboxDeletedItemSize -CsvFolder 'C:\Temp\Reports'

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