How to List group members and email addresses

D

Dave

I have been using ldifde to export a list of group members to a text
file using the following command (issued on the dc):

ldifde -f c:\outputfile.csv -r "(&(ObjectClass=Group)(CN=Specific
Group Name))" -l member

This gives me a listing of each member of the list "Specific Group
Name" in the following format (example):

member:
CN=Marakesh\, Ingvald,OU=G-M,OU=External Contacts,DC=cesa11,DC=com

I would like a listing that also shows each member's email address.
Is this possible using ldifde? Is there another method that will
work?

The purpose of this is to provide an easy-to-read printout or email to
someone who might need to update the distribution list.

Thanks,
Dave
 
J

Jerold Schulman

I have been using ldifde to export a list of group members to a text
file using the following command (issued on the dc):

ldifde -f c:\outputfile.csv -r "(&(ObjectClass=Group)(CN=Specific
Group Name))" -l member

This gives me a listing of each member of the list "Specific Group
Name" in the following format (example):

member:
CN=Marakesh\, Ingvald,OU=G-M,OU=External Contacts,DC=cesa11,DC=com

I would like a listing that also shows each member's email address.
Is this possible using ldifde? Is there another method that will
work?

The purpose of this is to provide an easy-to-read printout or email to
someone who might need to update the distribution list.

Thanks,
Dave

I don't know ldifde, but using the Active Directory command-line tools, tip 6820 in the 'Tips & Tricks' at http://www.jsiinc.com
run
GroupMembers "Group DN"

GroupMembers.bat contains:

@echo off
if {%1}=={} @echo Syntax: GroupMembers "Group DN"&goto :EOF
setlocal
set groupdn=%~1
set qrygrp=dsquery * domainroot -filter "(&(objectCategory=Group)(objectClass=Group)(distinguishedName=%groupdn%))" -attr member -L -limit 0
for /f "Tokens=*" %%a in ('%qrygrp%') do (
set members=%%a
call :parse1
)
endlocal
goto :EOF
:parse1
set mail=NONE
set qryusr=dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(distinguishedName=%members%))" -attr mail -L -Limit 0
for /f "Tokens=*" %%b in ('%qryusr%') do (
set mail=%%b
)
@echo "%members%";"%mail%"


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
D

Dave

Thanks for your reply. This looks like it should work, BUT...
It returns, "'dsquery' is not recognized as an internal or external
command, operable program or batch file."

I am not familiar with dsquery - guessing it is for querying Directory
Services?
When I do a search for dsquery on my server (dc), I find only a few
listings for dsquery.dll.

What should I do? Or where can I get 'dsquery.exe'?

Thanks,
Dave
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top