Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Get all SMTP addresses for a specific domain

Avatar of georgedschneider
georgedschneiderFlag for United States of America asked on
6 Comments1 Solution1103 ViewsLast Modified:
I'm trying to produce an output of all users with a specific primary email address.  The following script will produce this:

Get-Mailbox -ResultSize unlimited|Where-Object {$_.PrimarySMTPAddress.Domain -eq "domain.com"}|Select @{n='Name';e={$_.displayname}},@{n='Primary Email Address';e={$_.primarysmtpaddress}},@{name='All Email Addresses';e={$_.emailaddresses}}

I'd like to exclude all x500 addresses from the output.  I know using Where-Object {($_ -Like "SMTP:*")} will accomplish this but I can't get it to work with specifying desired domain.

Is there a way to look at both primary and secondary domains like i have in this script for primary domain?

Long term I'd like to remove smtp: so the output is just a listing of addresses.
Avatar of Qlemo
QlemoFlag of Germany image"Batchelor", Developer and EE Topic Advisor
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers