Wednesday, 11 September 2013

Archive Mailbox Stats

Although Personal Archives in Exchange 2010/2013 are often in cheaper and larger storage than “normal” mailboxes, we still need to keep an eye on them to check how archives are growing and how (if!) users are using it.
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

Azure Resource Support for Availability Zone

Over the years, an increasing number of services are consumed in the cloud and as architects one of the key considerations is designing the ...