Results 1 to 4 of 4

Thread: Export Usernames and Email Addresses

  1. #1
    Join Date
    Oct 2005
    Posts
    12

    Export Usernames and Email Addresses

    Hi, I’m running an Active directory successfully since past 2 years. Due to some reasons now I want to export usernames and email addresses from a particular user group. I know I can do this using NET GROUP command in DOS but that will only export Contacts and not the email address, right? So can anyone please tell me what would be the better way to export both email and contacts? Can it be done with LDAP?

    Please help.

  2. #2
    Join Date
    Sep 2004
    Posts
    144

    Re: Export Usernames and Email Addresses

    Yes, you can use LDAP to some extent but as per me Win2003 DSGet command would be far better than that of Net Commands. It should be like

    DSGet user /?

    ( -email = address seems promising)

    You may also be asked for combining the preliminary DSQuery User in order to get all of the User names for processing by DSGet.

  3. #3
    Join Date
    Sep 2004
    Posts
    129

    Re: Export Usernames and Email Addresses

    Type the following at a CMD.EXE window for an example:

    dsquery group -name "Domain Admins"|dsget group -members|dsget user -samid -email -display

    See if it helps.

  4. #4
    Join Date
    Sep 2005
    Posts
    185

    Re: Export Usernames and Email Addresses

    As i can assume your groups contain contacts, i think running the following script may help you out:

    @echo off
    if {%1}=={} @echo Syntax: GGME Group&goto :EOF
    setlocal ENABLEDELAYEDEXPANSION
    set grp=%1
    set grp=%grp:"=%
    for /f "Tokens=*" %%a in ('dsquery group -name "%grp%"') do (
    if %%a NEQ "" for /f "Tokens=*" %%x in ('dsget group %%a -samid^|Findstr /V /L /C:"dsget succeeded"') do set gdn=%%x#
    set gdn=!gdn: #=!
    if %%a NEQ "" for /f "Tokens=*" %%b in ('dsget group %%a -members -expand') do (
    set user=%%b
    set user=!user:"=!
    set ok=N
    set dn=
    set mail=
    if %%b GTR " " for /f "Tokens=1*" %%c in ('dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(distinguishedName=!user!))" -attr displayName mail -L -LIMIT 0') do (
    if /i "%%c" EQU "displayName:" set dn=%%d&set ok=Y
    if /i "%%c" EQU "mail:" set mail=%%d
    )
    if "!ok!" EQU "Y" if "!dn!" NEQ "" @echo "!gdn!" "!dn!" "!mail!"
    )
    )
    endlocal
    goto :EOF

Similar Threads

  1. Replies: 1
    Last Post: 08-06-2012, 06:41 PM
  2. Export Names and Email Addresses from Thunderbird
    By Mustafa k in forum Technology & Internet
    Replies: 5
    Last Post: 13-01-2011, 07:40 AM
  3. Export email addresses from mail?
    By The!Winston in forum Technology & Internet
    Replies: 5
    Last Post: 21-10-2010, 09:01 AM
  4. how to trace email addresses?
    By geokilla in forum Windows Software
    Replies: 5
    Last Post: 07-08-2009, 07:54 PM
  5. CSVD export of SMTP addresses
    By randy in forum Windows Server Help
    Replies: 6
    Last Post: 13-01-2009, 04:51 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,933,425.29114 seconds with 17 queries