Our users in Active Directory are in various 'root' Organizational Units, how can I search for them?
What I currently have working is:
$search = "CN=John Doe"
$user = "username"
$psw = "password"
$server = "ldap://servername.eng.company.co.uk";
$dn = "OU=North,DC=eng,DC=company,DC=co,DC=uk"; //this is where we have others, like OU=South,DC=eng,DC=company,DC=co,DC=uk but I need the users to search them all as they don't know what OU they are in
$ds=ldap_connect($server);
$r=ldap_bind($ds, $user , $psw);
$sr=ldap_search($ds, $dn, $search);
$data = ldap_get_entries($ds, $sr);
if I remove the OU part completely then it brings nothing back.
I have tried making it an array and doing the ldap_search
in a foreach loop but that brings nothing back either.
Please can someone point me in the right direction? many thanks