Pull SMTP address out of AD by user

I am I am looking for a way to pull all the SMTP address out of AD by user.  What is the best way to do this?
Thanks
sysdjAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ryangormanConnect With a Mentor Commented:
dsquery * -filter "(&(objectCategory=person)(objectClass=User)(mailNickname=*))" -attr sAMAccountName proxyaddresses -limit 0

Finds all mailbox-enabled users and outputs their account name and a semi-colon delimited field with all their addresses. You'll need to parse this output to filter out non SMTP addresses.
0
 
Steve KnightIT ConsultancyCommented:
You can use dsquery / dsget, e.g.

dsquery group -name "domain users" | dsget group -members | dsget user -fn -ln -email

find the domain users group, passes the full name of that into dsget to get the members and passes that into dsget to return the first name, lastname and email address,  You can pipe that into a text file with

> textfile.txt

on the end of the line

hth

Steve
0
 
sysdjAuthor Commented:
I am looking for all the SMTP address in use by accounts.  I may be mistaken, but I believe the switch email will only get the default.
0
 
Steve KnightIT ConsultancyCommented:
That isn't what you said first so I need to understand what you want exactly?  A list of all multiple email addresses per user?  For which users, members of a group or all users?


0
 
inbarasanCommented:
Dear sysdj,
Let me explain you what we use internally at our office. Normally there will be an alias created by default with the userid@yourdomain.com So we use this logic and create the list or send the mail to user. Hope this tip helps. Good luck.

Cheers!
Inba
0
All Courses

From novice to tech pro — start learning today.