Export list of all external senders (Exch2013/ExchOL)

Is there a way in PowerShell to export a list of all external email addresses that have sent to my company's users, say over the past month, in Exchange 2013 or Exchange Online?
Christian HansAsked:
Who is Participating?

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

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.

Andy MIT Systems ManagerCommented:
You could do this using the Message Tracking Log  in Exchange management Shell providing your logs go back far enough:

-getmessagetrackinglog -resultsize unlimited -start "12/01/2017 00:00" -End "01/01/2018 23:59" -EventID "Deliver" | select Sender, Recipients

You will want to output it to a text file or csv.
Christian HansAuthor Commented:
Thanks Andy, that will work on my Exchange 2013 servers, any ideas about Exchange Online? I realize that I'm limited to 30 days only.

Get-MessageTrace -Resultsize Unlimited -StartDate 12/5/2017 -EndDate 1/4/2018 | Select Received,SenderAddress,RecipientAddress,Subject | Export-CSV C:\MessageTrace_Results.csv -NoTypeInformation

-Resultsize Unlimited parameter wont work, and without it, it seems like the output is limiting the results to 1000.
Andy MIT Systems ManagerCommented:
I think Exchange Online is limited to 5000 results (from what I've read, seems to be a bit vague and haven't done a lot with Exchange Online Powershell as yet).

You could try -Resultsize 5000 to get maximum results available from them.
Challenges in Government Cyber Security

Has cyber security been a challenge in your government organization? Are you looking to improve your government's network security? Learn more about how to improve your government organization's security by viewing our on-demand webinar!

Christian HansAuthor Commented:
Yep, one would think that I could get more than 1000, but even the 5000 parameter wont work unfortunately.

$dateEnd = Get-Date
$dateStart = $dateEnd.AddDays(-30)
Get-MessageTrace -Resultsize 5000 -StartDate $dateStart -EndDate $dateEnd | Select-Object Received,SenderAddress,RecipientAddress,Subject | Export-CSV C:\MessageTrace_Results.csv -NoTypeInformation

A parameter cannot be found that matches parameter name 'Resultsize'.
Naveen SharmaCommented:
Use Get-MessageTrace PowerShell command to view and export information on mail sent and received in Exchange Online.

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
PberSolutions ArchitectCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

-- Naveen Sharma (https:#a42424697)
-- Andy M (https:#a42423697)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Cleanup Volunteer
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

From novice to tech pro — start learning today.