Export All External Only Mail Contacts in Your Organisation for Exchange On-Premise 2013!

I have been looking recently and I have been struggling to find any articles that showed me how to only get an export of external email contacts. All the blogs I’ve seen is just gathering every single contact, here’s what I used!

For easy access here is the code:

Get-MailContact -ResultSize Unlimited | Where-Object {_.externalemailaddress -notlike “*@<yourdomain.com>”} | Select-Object Name,ExternalEmailAddress,*when* | export-csv c:\users\user.name\documents\onpremexternalobjects.csv

That will filter out any users that have an email address containing your domain name.

Hope this helps!

Contact risual on our website or Twitter for more information.

About the author