Powershell exchange get-mail with specific subject wildcard use for specific recipient.

Hello,

Looking for help in searching for email via PS based on specific criteria and/or range.

Date range from to to
recipient : address known
subject: wild card use to match "*fishing*" or "*water team*"

Get-messagetrackinglog -ResultSize Unlimited -Start "12-16-2018 7:00:00AM" -End "12-18-2018 10:30AM"  -recipients:jdoe@domain.com | where{$_MessageSubject -like "*fishing*"| select-object Timestamp,sourcecontext,source,eventID,MessageSubject,Sender,{$_.Recipients} | format-table  

Above doesn't work for just one subject wildcard, while I haven't even gotten to include the 'or' other criteria yet.

Some assistance on syntax would be truly be appreciated.  Note on premise 2010 Exchange. Thank you.
LVL 1
dee30Asked:
Who is Participating?
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.

FOXActive Directory/Exchange EngineerCommented:
What exactly is the error it is throwing and it looks like you are missing a . in front of MessageSubject  - try this:  

Get-messagetrackinglog -ResultSize Unlimited -Start "12-16-2018 7:00:00AM" -End "12-18-2018 10:30AM"  -recipients:jdoe@domain.com | where{$_.MessageSubject -like "*fishing*"| select-object Timestamp,sourcecontext,source,eventID,MessageSubject,Sender,{$_.Recipients} | format-table
dee30Author Commented:
I got it to work... was missing the period(.) like you pointed out in front of where-objects listed, as well as a closing curly bracket/brace after *fishing*"}   .

So, that all said how would update the syntax to include an 'or' , i.e., subject line to include the word *fishing* OR *net* ?

Thank you.
FOXActive Directory/Exchange EngineerCommented:
Try the below:

Get-messagetrackinglog -ResultSize Unlimited -Start "12-16-2018 7:00:00AM" -End "12-18-2018 10:30AM"  -recipients:jdoe@domain.com | where{$_.MessageSubject -like "*fishing*" -and "*net*"} | select-object Timestamp,sourcecontext,source,eventID,MessageSubject,Sender,{$_.Recipients} | format-table

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
dee30Author Commented:
Thanks.. assigning points.  Will try that next time.. Done with Exchange for today and moving on to some vmware issues.  Thank you.
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.