I'm working on a project using PHP Adldap2 Library (https://github.com/Adldap2/Adldap2) and I need to retrieve a list of sub-OUs within a specific OU from Active Directory.
That's what I tried:
$ad->search()
->whereEquals(
ActiveDirectory::OBJECT_CATEGORY,
ActiveDirectory::ORGANIZATIONAL_UNIT_LONG
)
->whereEndsWith('dn', 'OU=myou,DC=mycompany,DC=com')
->get();
While the first filter works and retrieves all OUs, the second doesn't and returns an empty array. I also tried using 'distinguishedname'
instead of 'dn'
in whereEndsWith
, with the same result.
How can this be done?