Skip to content

Get-MailboxStatistics-Html

Exchange Online: HTML report of mailbox statistics

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [switch]$Archive
)

Process {
    try {
        [string[]]$Properties = @('DisplayName','ItemCount','TotalItemSize','DeletedItemCount','TotalDeletedItemSize','DatabaseIssueWarningQuota','DatabaseProhibitSendQuota','DatabaseProhibitSendReceiveQuota','IsArchiveMailbox','LastInteractionTime','IsValid')
        $boxes = Get-Mailbox -SortBy DisplayName -ErrorAction Stop
        if ($null -eq $boxes -or $boxes.Count -eq 0) {
            throw "Mailboxes not found"
        }
        $res = $boxes | Get-MailboxStatistics -Archive:$Archive -ErrorAction Stop | Select-Object $Properties

        if ($null -eq $res -or $res.Count -eq 0) {
            Write-Output "No mailbox statistics found"
            return
        }

        Write-Output ($res | ConvertTo-Html -Fragment)
    }
    catch { throw }
}
Off

Return mailbox statistics for archive mailboxes associated with the specified mailboxes

An interactive directory of PowerShell scripts.