?
Solved

ldap query in php to find users in group

Posted on 2005-03-03
2
Medium Priority
?
322 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

762 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