
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
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
thats awsome! thanks.
ReplyDeletegreat stuff !!
ReplyDeleteThis is the best script ever - makes my life easier.
ReplyDelete