exchange 2010 message tracking, i want to exclude my domain for the results on incoming and outgoing

I tried the following commands with no success

get-messagetrackinglog -Recipient userX@domainx.com -Start “12/01/2017 12:01 AM” -End “12/07/2017 03:30 PM” -resultsize unlimited |  Where-object {$_.senders -notlike "*@domainx.com"} | select-object sender, timestamp, messagesubject, {$_.recipients} | export-csv “c:\export1.csv”

get-messagetrackinglog -Sender userX@domainx.com -Start “12/01/2017 12:01 AM” -End “12/07/2017 03:30 PM” -resultsize unlimited |  Where-object {$_.recipient -notlike "*@domainx.com"}  | select-object sender, timestamp, messagesubject, {$_.recipients}| export-csv “c:\export2.csv"
ColdnorthAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jose Gabriel Ortega CastroEE Solution Guide - CEO Faru Bonon ITCommented:
You are filtering the senders using "UserX@domainX.com" but then you don't want anything with senders in your domain, that will bring nothing into it, because the -sender "userX@domainx.com" will always be true and in the where will always be false.
0
Jose Gabriel Ortega CastroEE Solution Guide - CEO Faru Bonon ITCommented:
Maybe you want to get the recipients not in your domain that are sending the user in sender. That would be something like this:


get-messagetrackinglog -sender UserX@domainX.com -Start "12/01/2017 12:01 AM" -End "12/07/2017 03:30 PM" -resultsize unli
mited | select * | where-object{ foreach($recp in $_.Recipients){ $recp -notmatch "domainX.com"}}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ColdnorthAuthor Commented:
Sweet!
That makes more sense

Thank you!
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.