Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Active Directory
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , ,

Sponsored Links



Export Usernames and Email Addresses

Active Directory


Reply
 
Thread Tools Search this Thread
  #1  
Old 10-02-2005
Dave B
 
Posts: n/a
Export Usernames and Email Addresses

Hello,

I am trying to export usernames and email addresses from a
particular user group in Active Directory. I can export
users from the group using the NET GROUP command in DOS but
that doesn't include email addresses. Do I have to use a
LDAP query or is there an easier way to do it?

Many Thanks!!

Dave
Reply With Quote
  #2  
Old 10-02-2005
Herb Martin
 
Posts: n/a
Re: Export Usernames and Email Addresses

"Dave B" <dbenivegna@sargentlock.com> wrote in message
news:125d01c50f8b$3413f0c0$3a01280a@phx.gbl...
> Hello,
>
> I am trying to export usernames and email addresses from a
> particular user group in Active Directory. I can export
> users from the group using the NET GROUP command in DOS but
> that doesn't include email addresses. Do I have to use a
> LDAP query or is there an easier way to do it?


Well in some sense yes but you can probably use the Win2003
DSGet command -- it is far more capable than the Net commands.

DSGet user /?

( -email = address seems promising)

You may also need to combine this with a preliminary DSQuery User
to get all of the User names for processing by DSGet.

I.E., DSQuery finds the users, DSGet displays the attributs for a
particular (set of) user(s).

DSQuery user /?

You can also look into the ADSI ScriptOMatic by searching
Microsoft for it....

Google: [ site:microsoft.com ADSI ScriptOMatic ]

(It helps (non-) programmers write useful scripts.)



Reply With Quote
  #3  
Old 10-02-2005
Jerold Schulman
 
Posts: n/a
Re: Export Usernames and Email Addresses

On Thu, 10 Feb 2005 08:11:39 -0800, "Dave B" <dbenivegna@sargentlock.com> wrote:

>Hello,
>
>I am trying to export usernames and email addresses from a
>particular user group in Active Directory. I can export
>users from the group using the NET GROUP command in DOS but
>that doesn't include email addresses. Do I have to use a
>LDAP query or is there an easier way to do it?
>
>Many Thanks!!
>
>Dave



DSQUERY / DSGET from the Active Directory command-line tools. See tip 6820 in the 'Tips & Tricks' at http://www.jsiinc.com

See tip 7714.

Type the following at a CMD.EXE window for an example:
dsquery group -name "Domain Admins"|dsget group -members|dsget user -samid -email -display

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
Reply With Quote
  #4  
Old 11-02-2005
Jerold Schulman
 
Posts: n/a
Re: Export Usernames and Email Addresses

On Thu, 10 Feb 2005 08:11:39 -0800, "Dave B" <dbenivegna@sargentlock.com> wrote:

>Hello,
>
>I am trying to export usernames and email addresses from a
>particular user group in Active Directory. I can export
>users from the group using the NET GROUP command in DOS but
>that doesn't include email addresses. Do I have to use a
>LDAP query or is there an easier way to do it?
>
>Many Thanks!!
>
>Dave



Run the following, since your groups contain contacts:

@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


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Active Directory


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Export Usernames and Email Addresses"
Thread Thread Starter Forum Replies Last Post
Export Names and Email Addresses from Thunderbird Mustafa k Technology & Internet 5 13-01-2011 07:40 AM
Export email addresses from mail? The!Winston Technology & Internet 5 21-10-2010 09:01 AM
LDIF Export of All user email addresses for individual Exchange server Paul Active Directory 2 07-08-2009 11:52 PM
Importing email addresses dhd Active Directory 5 11-02-2009 05:13 AM
CSVD export of SMTP addresses randy Windows Server Help 6 13-01-2009 04:51 AM


All times are GMT +5.5. The time now is 05:36 PM.