Jump to content

PHP LDAP query to list all security groups not returning managedBy


Deborah

Recommended Posts

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.