Exchange Powershell script for mailbox statistics via email

The below powershell script will get the size and item count of each Exchange mailbox and send a .txt file via email to the configured recipient.

###Send mailbox statistics script

###Now get the stats and store in a text file
Get-Mailbox -Resultsize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label=”TotalItemSize(MB)”;expression={$_.TotalItemSize.Value.ToMB()}},ItemCount | Out-File -FilePath c:\mailboxes.txt

function sendmail($body)
$SmtpClient = new-object
$MailMessage = New-Object
$SmtpClient.Host = “IP Address of SMTP server”
$mailmessage.from = “”
$mailmessage.Subject = “Exchange 2007 Mailbox Sizes”
$MailMessage.IsBodyHtml = $false


This entry was posted in Exchange 2007 Powershell commands and scripts. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s