?
Solved

ldap query in php to find users in group

Posted on 2005-03-03
2
Medium Priority
?
323 Views
Last Modified: 2013-12-03
Active Directory:
Given a group name, I need a query that will find all the members that are in the group and their names and email. I using php to call the query and process the results:

$filter = ?????;
$fields = array('dispayName','memberof','mail');
$sr=ldap_search($conn,$base_dn,$filter,$fields);
0
Comment
Question by:whozie
2 Comments
 
LVL 2

Author Comment

by:whozie
ID: 13455061
I figured it out:

$group = 'SomeGroup'; //name of group you want to list members of
$groupdir = 'OU=MH Users and Groups,DC=mh,DC=local'; //directory where the group resides
$filter = 'memberof=cn=$group,$groupdir'; //filter
$fields = array('dispayName','memberof','mail');

ldap_search($connect, $base_dn, $filter,$fields);


Also you can wrap it with an '&' and objectClass=person to make the search more effiecient:

IE: $filter='($(objectClass=person)(......))';


0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 13461870
Question answered by asker or dialog deemed valuable.
Closed, 250 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question