Monday, January 12, 2009

How to Export User mailboxes and its size into Excel spreadsheet

Task:

This is classic one and I am sure there are tons of examples on the internet. Report all mailboxes, names, and their size in exchange 2007. This task is very simple and easy to achieve with exchange 2007.

Solution:

Log into exchange server or management PC and open Exchange EMS (Shell). Either copy paste or type the fallowing command into EMS. Ps: Where ever you are running this cmdlet from there will be a file created as "MailReport.csv", open it with excel and format it as you wish.

Get-MailboxStatistics Sort-Object TotalItemSize -Descending select DisplayName,@{expression={$_.TotalItemSize.Value.ToKB()}},ItemCount export-csv MailReport.csv


Here is another one gives same report for per database (you need to change the below variables to your own)

  • Exchange server name: EXC07
  • Storage group name: SG01
  • Database name: SG01MB1

Get-MailboxStatistics -Database "Exc07\SG01\SG01MB1" select DisplayName, ItemCount, TotalItemSize export-csv -path e:\Reports\SG1.csv


This example, I have created folder on the e drive called "Reports". When you have the output open with Excel and format it as you wish

So the sum it up

  • Get-MailboxStatistics Sort-Object TotalItemSize -Descending select DisplayName,@{expression={$_.TotalItemSize.Value.ToKB()}},ItemCount export-csv MailReport.csv
  • Get-MailboxStatistics -Database "Exc07\SG01\SG01MB1" select DisplayName, ItemCount, TotalItemSize export-csv -path e:\Reports\SG1.csv


Thanks,

Oz

Oz ozugurlu

Oz ozugurlu MVP (Exchange)

MCITP (EMA), MCITP (EA) MCITP (SA),

MCSE (M+, S+) MCDST,

Security+, Server +, Project+

No comments: