Export all smtp addresses to .txt file

Discussion in 'Scripting' started by Rob S, Feb 10, 2006.

  1. Rob S

    Rob S Guest

    I'm trying to figure out an easy way to pull all smtp addresses stored in AD,
    and export them to a text file.

    Any ideas?
     
    Rob S, Feb 10, 2006
    #1
    1. Advertisements

  2. Rob S

    Jason Guest

    Do an Ldap export of the smtp address and the user names.
     
    Jason, Feb 10, 2006
    #2
    1. Advertisements

  3. Rob S

    Rob S Guest

    It's been awhile since I've done anything with LDAP. Can you tell me how to
    do an LDAP export, or point me somewhere that I could read up on it?
    Thanks.
     
    Rob S, Feb 10, 2006
    #3
  4. Rob S

    Umesh Thakur Guest

    If you're using WINDOWS 2003, you can use command below to export all email
    addresses to a text file:

    dsquery * -filter "&(ObjectCategory=User)" -scope subtree -attr
    name,proxyAddresses

    this will list user name and e-mail addresses in command window. do pipe the
    output to a text file using:

    dsquery * -filter "&(ObjectCategory=User)" -scope subtree -attr
    name,proxyAddresses > d:\test.txt

    Or, use the article below to export AD objects using LDIFDE util:
     
    Umesh Thakur, Feb 10, 2006
    #4
  5. Rob S

    Rob S Guest

    Thanks alot. I'll give this a try.


     
    Rob S, Feb 10, 2006
    #5
  6. Rob S

    Rob S Guest

    I run the command as just as you have it and I get this message:
    "Dsquery has reached the default limit of 100 results to display: use the
    -limit option to display more results"

    Also, when I look at the text file that I cat the output into, the only
    thing in there is:
    "name,proxyAddresses"

    Any ideas? I appreciate the help
     
    Rob S, Feb 10, 2006
    #6
  7. Rob S

    Umesh Thakur Guest

    Try running these dsquery commands to display output on screen. If you can
    see the output on command window, you can also redirect it to a text file:

    dsquery * -filter "&(ObjectCategory=User)" -scope subtree -attr
    name


    dsquery * -filter "&(ObjectCategory=User)" -scope subtree -attr
    sAMAccountName, name

    Bydefault, dsquery will not return more than 100 records. to override this
    limit, use -limit <num>
    where <num> is new limit. like, 1000

    dsquery * -filter "&(ObjectCategory=User)" -scope subtree -attr
    sAMAccountName, name -limit 1000
     
    Umesh Thakur, Feb 10, 2006
    #7
  8. Rob S

    Umesh Thakur Guest

    sorry, I goofed up with this one.
    Since proxyAddresses is an array of email addresses, dsquery did not return
    anything.

    try following CSVDE command to export user emails in CSV format.

    csvde -f userEmail.txt -r "(objectClass=User)" -l "displayName,proxyAddresses"

    this command will export all user's DN, display name and all email addresses
    to userEmail.CSV file.

    after export, import this CSV file in excel, delimited with comma.
    if an user has more than one email, they will be separated using semicolon.
     
    Umesh Thakur, Feb 12, 2006
    #8
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.