Number of E-mails Sent and Received by one User

by Nuno Mota [Published on 17 Oct. 2012 / Last Updated on 18 Sept. 2012]

This tip shows how to count the number of e-mails a user sent/received

Have you ever needed to check how many e-mails a particular user sent and received in a day? Or maybe in a week or in a month? The following script will help you achieve this:

[Int] $intSent = $intRec = 0

Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start “10/01/2012” -End “11/01/2012” -Sender "user@domain.com" -EventID RECEIVE | ? {$_.Source -eq "STOREDRIVER"} | ForEach { $intSent++ }

Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start “10/01/2012” -End “11/01/2012” -Recipients "user@domain.com" -EventID DELIVER | ForEach { $intRec++ }

Write-Host "E-mails sent:    ", $intSent

Write-Host "E-mails received:", $intRec

Featured Links