Deborah Posted April 27, 2009 Share Posted April 27, 2009 I am new to PHP and Active Directory. I am trying to query active directory using PHP. I have been able to query and get a list of all security groups with the given filters. I can't however seem to get the managedBy attribute returned. I would actually like to get the Display Name of the ManagedBY dn. My goal is to have a list of all security groups, grouped by the ManagedBy Person. Here is the code I'm using. Any help would be appreciated. <?php // Include code to connect to ldap server include("ldap_connect.php"); // Base dn for search $base_dn = "dc=oilstates, dc=net"; // Filter for search //$filter = "(|(groupType=-2147483640)(groupType=-2147483646)(groupType=-2147483644))"; //| means or so only one condition must be met // This filter is only for testing purposes The one above is the one that shows all security groups $filter = "(&(groupType=-2147483646)(name=*IT -*))"; // Specify only those parameters we're interested in displaying $attributes = array("name","description", "managedBy", "info"); // $connect comes from ldap_connect.php $search = ldap_search($connect, $base_dn, $filter, $attributes) or exit(">>Unable to search ldap server<<"); $info = ldap_get_entries($connect, $search); echo $info["count"]." entries returned<p>"; for ($i=0; $i<$info["count"]; $i++) { echo $info[$i]["name"] [0]." (".$info[$i]["description"][0].") ".$info[$i]["info"][0]."<br />"; echo " - ".$info[$i]["managedBy"][0]."<br />"; } ldap_unbind($connect); ?> Deborah Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.