Here’s a simple script to get some statistics regarding all the archive mailboxes in your environment:
$mbcombCollection = @()
$archiveMbxs = Get-Mailbox
-Archive -ResultSize Unlimited | Select Identity, ArchiveWarningQuota, ArchiveQuota
ForEach ($mbx
in $archiveMbxs)
{
$mbxStats =
Get-MailboxStatistics $mbx.Identity -Archive | Select DisplayName, StorageLimitStatus, TotalItemSize,
TotalDeletedItemSize, ItemCount, DeletedItemCount, Database
$mbcomb = "" | Select "Display Name",
StorageLimitStatus, "TotalItemSize (MB)", "TotalDeletedItemSize (MB)", ItemCount, DeletedItemCount, Database, "ArchiveWarningQuota
(GB)", "ArchiveQuota
(GB)"
$mbcomb."Display Name" = $mbxStats.DisplayName
$mbcomb.StorageLimitStatus =
$mbxStats.StorageLimitStatus
$mbcomb."TotalItemSize (MB)" = [math]::round($mbxStats.TotalItemSize.Value.ToMB(),
2)
$mbcomb."TotalDeletedItemSize (MB)" = [math]::round($mbxStats.TotalDeletedItemSize.Value.ToMB(),
2)
$mbcomb.ItemCount =
$mbxStats.ItemCount
$mbcomb.DeletedItemCount =
$mbxStats.DeletedItemCount
$mbcomb.Database =
$mbxStats.Database
$mbcomb."ArchiveWarningQuota (GB)" = $mbx.ArchiveWarningQuota.Value.ToGB()
$mbcomb."ArchiveQuota (GB)" = $mbx.ArchiveWarningQuota.Value.ToGB()
$mbcombCollection +=
$mbcomb
}
#$mbcombCollection
$mbcombCollection
| Export-Csv D:\Scripts\Reports\"ArchiveStats_$(Get-Date
-f 'yyyyMMdd').csv" -NoType
No comments:
Post a Comment