Powershell Script to check how many emails were Sent and Received by a specific user

Powershell Script to check how many emails were Sent and Received by a specific user:

[Int] $intSent = $intRec = 0

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

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

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

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