PHP LDAP get members of Container/Group/OU, overcoming 1000 result limit – mydap Version 4

In mydap() version 4 we can query all members of a container, group, or organizational unit. LDAP pagination has also been incorporated, allowing results to exceed the 1000 limit.

See the end of the script for example usage. Feel free to ask questions in the comments.

Update 2/4/2017: Added support to overcome 1500 attribute limit affecting groups.

Use PHP and LDAP to list members of an Active Directory group – Version 3

An UPDATED version of this script can be found here: Version 4 (NEW)

PHP function that gets the members of an Active Directory group, and returns the data as an array. Additional function provided to get Users’ attributes.

In this version (Version 3) we can search groups across multiple OU’s– and even multiple AD servers (by closing and establishing a new connection).

I hope you find it useful.

Use PHP and LDAP to get a user’s group membership, including the primary group

The function below queries a user’s memberOf attribute to get a list of groups. It then uses user’s primaryGroupID to retrieve the distinguishedName of the corresponding primary group. The results are returned in a single, neat, array. This function can have many applications including use with a login system.

The Function

Example Output

Use PHP and LDAP to list members of an Active Directory group – Version 2

An UPDATED version of this script can be found here: Version 4 (NEW)

PHP function that gets the members of an Active Directory group, and returns the Users’ attributes as an array.

The Function

Example Output