I am trying to just get all the global and local groups from active directory.
I am able to bind to the ldap, but I don't know how to go about getting the groups.
Can someone help?
The following code worked with set variables:
$ldapconn = ldap_connect($ad_host,$ad_port) or die("Could not connect to LDAP server.");
@ldap_set_option($ldapconn , LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldapconn , LDAP_OPT_REFERRALS, 0);
// binding to ldap server
$ldapbind = ldap_bind($ldapconn,$userlogin, $password);
This is where I don't know what filter to use to get the group:
$baseDN = "dc=test,dc=local";
$strFilter = "(ou=accounts)";
$strAttributes = array("Group");
$group_search = ldap_search($ldapconn,$baseDN,$strFilter,$strAttributes);