Check the total number of OutBound messages

Hello Friends,
Is there any way , so that i can check the total number of OutBound messages sent to the following domain addresses for the month
as an example. abc.com, or zyx.com.

The script that i am using is :

$billing = Get-TransportServer -identity “prv” | Get-MessageTrackingLog -resultsize unlimited -Start “03/10/2016” -End “04/07/2016” -EventId Send | where-object {$_.Recipients -like “*@abc.com, *@zyx.com,"}

$billing.Count

but it is not returning any result.
Please help.

For multiple domains, you’d need -or between them:

$billing = Get-TransportServer -identity “prv” | Get-MessageTrackingLog -resultsize unlimited -Start “03/10/2016” -End “04/07/2016” -EventId Send | where-object {$.Recipients -like “*@abc.com" -or $.Recipients -like “*@zyx.com”}

AK

Thanks for your reply @AK

but if only try to get one domain, i am not getting anything.

$billing = Get-TransportServer -identity “prv” | Get-MessageTrackingLog -resultsize unlimited -Start “04/05/2016” -End “04/10/2016” -EventId Send | where-object {$_.Recipients -like “*@abc.com"}

and i am pretty sure the domain is valid and most of the users are sending email to this domain. even though i send some test email to this domain and i am not getting any result.
Please advise.

Is abc.com local/internal domain or potentially they ended up in -eventid Fail category?

This is not Local/Internal domain. This is an External company domain. we would like to know how many uses are sending email to “abc.com” domain in a month or week from our exchange server? we need to know the total number of the month or week.
hope this will help.

Try using match operator: where-object {$_.recipients -match “abc.com”} . Or, to find out why eventid send produces no output, narrow it down to 1 test message, get message id, then search for it without eventid filter: get-messagetrackinglog -MessageId “messageid”.

Thanks guys , i found my solutions.

$Search = Get-TransportServer -identity “prv” | Get-MessageTrackingLog -resultsize unlimited -Start “04/08/2016” -End “04/10/2016” -EventId Send |
where-object {$.Recipients –like “@abc.ca” –or $.Recipients –like “online.de” –or $_.Recipients –like “hello.net”}

$Total=$Search | where-object {$_.Recipients –like “*@abc.ca*” –or $_.Recipients –like “*online.de*” –or $_.Recipients –like “*hello.net*”} 
$totalCount=$Total.count

Thanks guys for your help and support.

Hello Guys,
It is worth noting that capturing all the logs from all emails in a given period of time is a very RAM intensive task. Especially if we are only using it to get a count. Is There any a better way to get the count without collecting all of them into a variable.

I just need to know how email send last month from our Exchange environment and also some the domain that i have mention.
any idea … please share.