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?
Naveen SharmaConnect With a Mentor Commented:
Use Get-MessageTrace PowerShell command to view and export information on mail sent and received in Exchange Online.
Andy MInternal 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.
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Andy MConnect With a Mentor Internal 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.
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'.
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.