Powershell – Microsoft Exchange 2010: How to get a count of e-mails received for a particular mailbox for a particular date

exchangeexchange-2010powershell

I am using Microsoft Exchange 2010.

How can I get a count of e-mails received for a particular mailbox for a particular date?

For example I want to see how many e-mails london.sales-inbound@company.com has received on a particular date and compare it to another site.

Best Answer

As indicated in the comments, you'll need to query the transport servers for the so-called "Message Tracking logs"

The example below will retrieve any "RECEIVE" event performed by the STOREDRIVER, that is, every time a message was actually delivered to the mailbox

(Get-TransportServer | Get-MessageTrackingLog -Recipients "london.sales-inbound@company.com" -EventID "RECEIVE" -Source "STOREDRIVER").Count

You can specify -Start and -End parameters to limit the search to a specific time range, like:

Get-MessageTrackingLog -Start (Get-Date 00:00:00).AddDays(-1) -End (Get-Date 23:59:59).AddDays(-1)

The above example will limit the query to all of yesterday