Skip to content

Get-MailboxStatistics

Exchange Online: Gets mailbox statistics for a specified mailbox

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$MailboxId,
    [switch]$Archive
)

Process {
    try {
        $box = Get-Mailbox -Identity $MailboxId -ErrorAction Stop
        if ($null -eq $box) {
            throw "Mailbox not found"
        }
        $result = Get-MailboxStatistics -Identity $MailboxId -Archive:$Archive -ErrorAction Stop
        $result | ForEach-Object {
            $_ | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force
        }
    }
    catch { throw }
}

Alias, Display name, Distinguished name, SamAccountName, Guid or user principal name of the mailbox

Off

Return mailbox statistics for the archive mailbox associated with the specified mailbox

An interactive directory of PowerShell scripts.