Friday, November 20, 2009

Mailbox Reporter for Exchange 2007 & 2010

By:Rik Hoffelder
Exchange 2007 and 2010 brought about many great new features and functions. However Microsoft forgot about the little guy when it came to getting a quick overview of mailbox statistics via a GUI. It really made quite a few of my customers unhappy. It’s not that Exchange 2007 or 2010 do not provide this information, it is only available on individual mailbox properties in the Exchange Management Console, you cannot view all mailboxes on a given store without using the Get-MailboxStatistics cmdlet then piping the output to a file.

While this is all well and good, most Exchange Admins moving from 2000 or 2003 to 2007 aren’t familiar with PowerShell, let alone Exchange Management Shell. As a result I wrote this handy little script to replace that functionality and view all mailboxes within the organization. It’s run from Exchange Management Shell using the following command:

C:\Scripts> ./MailboxReport.PS1

It then opens the report in a web browser as shown below:



Just copy the code below and paste into a text file named MailboxReport.PS1 then run as described above. It works with Exchange 2007 or Exchange 2010. I hope you find it useful!

#Exchange Mailbox Reporter
$a = "<style>"
$a = $a + "BODY{background-color:white;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:LightBlue}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:White}"
$a = $a + "</style>"
$b = "<H2> Mailbox Summary Report </H2>"
$servers = get-mailboxserver
Foreach ($server in $servers) {
Get-MailboxStatistics -server $Server |
Where-Object {$_.DisplayName -NotMatch "^CAS_"} |
Where-Object {$_.DisplayName -NotMatch "^SystemMailbox"} |
Where-Object {$_.DisplayName -NotMatch "^Microsoft System"} |
Select-Object DisplayName, ItemCount, TotalItemSize, StorageLimitStatus, LastLogonTime, LastLogoffTime, LastLoggedOnUserAccount, ServerName, Database |
Sort-Object TotalItemSize -descending |
ConvertTo-HTML -head $a -body $b |
Out-File MailboxReport.htm
}
Invoke-Expression ./MailboxReport.htm







More information on Exchange

3 comments:

  1. thats awsome! thanks.

    ReplyDelete
  2. This is the best script ever - makes my life easier.

    ReplyDelete

Note: Only a member of this blog may post a comment.

Microsoft Virtualization, Citrix, XENServer, Storage, iscsi, Exchange, Virtual Desktops, XENDesktop, APPSense, Netscaler, Virtual Storage, VM, Unified Comminications, Cisco, Server Virtualization, Thin client, Server Based Computing, SBC, Application Delivery controllers, System Center, SCCM, SCVMM, SCOM, VMware, VSphere, Virtual Storage, Cloud Computing, Provisioning Server, Hypervisor, Client Hypervisor.