I am using this library to interact with Active Directory in Python:
http://timgolden.me.uk/python/ad_cookbook.html
I am trying to access the group names like this:
groups = []
for group in active_directory.search(objectClass='group'):
groups.append(str(group.cn))
My first issue is that group.cn gets the display name of the group instead of the actual object name. How do I get the object name?
My second issue is that running this code takes up HUGE amounts of memory. When there are thousands of groups in Active Directory, my program will use hundreds of megs or even a gig or two of memory. This is especially true when there are groups nested inside other groups. Is there a reason why after I’ve gotten all the group names, I am still using all that memory?
This is what I ended up doing: