This is just an example illustrating how to connect to the LDAP and get users and groups within a particular OU.

  1. The first part connects to the LDAP
  2. Second part gets all the groups within the specified OU and puts them in an array
  3. Last part gets loops through the groups and gets all the users within each group and puts them in a array

Fill your LDAP connection parameters in this part

This part will get all groups within the OU. You may need to change OU=User Accounts part if your User Accounts are in a different OU e.g. Employee Accounts


This part will get all users within each of the groups


Echoes all the groups and users


 

Leave a Reply

Your email address will not be published. Required fields are marked *