I want to be able to look up user information (e-mail addresses and telephone numbers for example) in Active Directory, from within my Rails application. I've been banging my head against a brick wall for a couple of days trying to get the Ruby LDAP tools working on a Windows system without success. Then I thought, why don't I just do it the way I would do it in VBScript. Three lines of ruby code later and I'm outputing the list of objects in my root "people" OU container.
Code:
require "win32ole"

# Creates a new LDAP object which is the people OU.
myLDAP = WIN32OLE.connect("LDAP://server.domain.com/ou=people,dc=domain,dc=com")

#Loop through the sub objects outputing their name
myLDAP.each {|child| puts child.name}
I only want read access to the data so I'm not concerned if I can't write to AD this way.

Anyone know if there are any issues with this way of accessing AD?
Do I need to close the myLDAP object when I've grabbed the information I want, and if so what is the best way of doing it?