Exchange 2010 Archive Mailbox Statistics PowerShell script

0

Here are some field notes from a recent Exchange 2010 Retention and Archive case.

I have made a simple Exchange 2010 PowerShell script Get-ArchivedMBStats.ps1, that shows mailbox statistics for all mailboxes that have Online Archive enabled. It is great for following the progress of archiving of individual mailboxes.

The output of the script is the following information about each mailbox with archive enabled:

  • Mailbox Display Name
  • Mailbox TotalItemSize (MB)
  • Mailbox ItemCount
  • Mailbox Database
  • Mailbox RetentionPolicy
  • Archive Display Name
  • Archive TotalItemSize (MB)
  • Archive ItemCount
  • Archive Database
      The output is show as:

    Display Name    TotalItemSize (MB)   ItemCount    Database      RetentionPolicy
    ————    —————–    ———    ——–      —————
    Peter Schmidt                 147         3572      EXDB01    Default Archive..
    Online Archive – Pet…       430         4798      ARDB01

Here is the code (download as zip at the end of the article):

Download script here:

Redirect to TechNet Gallery.

Share.

About Author

Peter is an Exchange specialist with over 15+ years of experience with Exchange Server and certified Microsoft Certified Master (MCM) and Microsoft Certified Solutions Master (MCSM) on Exchange Server. He has been awarded the Microsoft MVP for seven years, since 2007. He is active in the Microsoft community and User Group Leader for CoLabora (a danish UC User Group). He works as an Infrastructure Architect and Consulent, with primary focus on Exchange, Lync and Office 365.

No Comments

  1. Pingback: Exchange 2010 Archive Mailbox Statistics PowerShell script - Peter Schmidt - IT-experts.dk

  2. Pingback: msdigest.net » How to copy Online Archive data back into the mailbox

  3. can you be more select on what server to run this script on?  I don't want to run the script at the organization level, just site level…

  4. I have tried using the script and i get the following errors

    Cannot bind argument with parameter identity because it is a null
    You can’t call a method on a null-valued expression.

    This script is exactly what i needed but its rendering no output for me. Any help would be appreciated. BTW Great Job on the Script!!

    THANKS

  5. My question is, can I schedule this in Task scheduler to send out a report via .html? If so what how do I add the syntax in task scheduler to accommodate the out-file?

  6. Niels Wijnja on

    (Ignore my previous comment please, script had a fault in it)

    Made a modified version that’s easier to export to CSV (one line per user) and just holds the username / size / databasenames:

    ###########################################################################
    #
    # NAME: Get-ArchivedMBStats.ps1
    #
    # AUTHOR: Peter Schmidt / Niels Wijnja
    # EMAIL: peter@msdigest.net / niels.wijnja@kpn.com
    #
    # COMMENT: Shows all mailboxes that are enabled for Online Archvie in Exchange 2010. Output shows both Mailbox and Archived Mailbox statistics.
    #
    # You have a royalty-free right to use, modify, reproduce, and
    # distribute this script file in any way you find useful, provided that
    # you agree that the creator, owner above has no warranty, obligations,
    # or liability for such use.
    #
    # VERSION HISTORY:
    # 1.0 2011.09.29 – Initial release
    # 1.1 2014.03.07 – Modified version best suitable for Export-CSV
    #
    # OUTPUT EXAMPLE:
    # Identity Size (MB) Database ArchiveSize (MB) ArchiveDatabase
    # ———— ————– ——– —————- —————
    # domain.extUsersPeter.Schmidt 147 EXDB01 555 EXARCHDB01
    #
    # HOW TO RUN:
    # .Get-MailboxSizes.ps1 | ft
    # .Get-MailboxSizes.ps1 | Export-CSV MailboxSizes.csv
    #
    # INPUTS:
    # None. You cannot pipe objects to this script.
    #
    ###########################################################################

    $combCollection = @()

    Write-Host “nPlease wait...n”

    $archiveMailboxes = Get-Mailbox -resultsize 100000 | where {$_.ArchiveDatabase -ne $null} | Select Identity, RetentionPolicy

    ForEach ($mbx in $archiveMailboxes)
    {

    $mbxStats = Get-MailboxStatistics $mbx.Identity | Select DisplayName, TotalItemSize, ItemCount, Database
    $archiveStats = Get-MailboxStatistics $mbx.Identity -Archive | Select DisplayName, TotalItemSize, ItemCount, Database

    $mbcomb = “” | Select Identity, “Size (MB)”, Database, “ArchiveSize (MB)”,ArchiveDatabase

    $mbcomb.Identity = $mbx.Identity
    $mbcomb.”Size (MB)” = [math]::round($mbxStats.TotalItemSize.Value.ToMB(), 2)
    $mbcomb.Database = $mbxStats.Database
    $mbcomb.”ArchiveSize (MB)” = [math]::round($archiveStats.TotalItemSize.Value.ToMB(), 2)
    $mbcomb.ArchiveDatabase = $archiveStats.Database

    $combCollection += $mbcomb
    # $combCollection += $archcomb
    # $combCollection += “n"
    }
    write-output $combCollection
    Write-Host "
    nList of archived mailboxes done…`n” -Foregroundcolor Green

    • Not without modification, since the script then need to connect to Exchange Online.
      But if connected to Exchange Online, it should be possible to make such a report. Possible with minor modifications.

Leave A Reply

Copyright 2005-2015 - Peter Schmidt.