This is just a small function that I wrote to connect to an LDAP server. It will connect to one server but will take multiple domains within that server as arguments. It parses the results and outputs three very common fields (firstname, lastname, and email address). The code is pretty well documented, so I’ll just leave it at that.