Wednesday 3 August 2022

PowerShell Exchange 365 Output Archive sizes and Quota

$table = New-Object System.Data.DataTable
$table.Columns.Add("Name", "System.String")
$table.Columns.add("Archive_Size", "System.String")
$table.Columns.add("Archive_Quoted", "System.String")
$table.Columns.add("AutoExpand", "System.String")

Foreach ($i in (Get-Mailbox -Archive | sort Name)) {
    $archive = $i | Get-MailboxStatistics -Archive
    $row = $table.NewRow()
    $row.Name = $i.Name
    $row.Archive_Quoted = $i.ArchiveQuota
    $row.Archive_Size = $archive.TotalItemSize
    $row.AutoExpand = $i.AutoExpandingArchiveEnabled
    $table.rows.add($row)
}

cls
$table | Format-Table

No comments:

Post a Comment