Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 945
  • Last Modified:

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
0
sysdj
Asked:
sysdj
1 Solution
 
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
 
ryangormanCommented:
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

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now