Categories
Exchange Server 2010

Exchange 2010 ; Mailbox Statistics with sAMAccountName

I needed to get mailbox statistics, alongside user sAMAccountName in order to plan an Exchnage 2010 migration; the script below is a modified version of one I found here. Save as a “.ps1” file and run from the Exchange Management Shell, the script will create a csv file under C:\Temp.

{code lang:php showtitle:false lines:false hidden:false}$r=@()
get-mailboxdatabase * | get-mailbox -resultsize unlimited | foreach {$l = “”| Select sAMAccountName,displayName,Size,serverName,databaseName,ItemCount; $l.sAMAccountName = $_.samaccountname; $l.Size =
 (get-mailboxstatistics -id $_.distinguishedname).totalitemsize; $l.displayName = $_.DisplayName; $l.ItemCount = (get-mailboxstatistics -id $_.distinguishedname).ItemCount; $l.databaseName = $_.database; $l.serverName = $_.serverName; $r += $l};
$r | export-csv c:\Temp\Sizing.csv -notype -encoding ascii {/code}

 

Leave a Reply

Your email address will not be published. Required fields are marked *