Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8205421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:13:58+00:00 2026-06-07T08:13:58+00:00

I am using this library to interact with Active Directory in Python: http://timgolden.me.uk/python/ad_cookbook.html I

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:14:03+00:00Added an answer on June 7, 2026 at 8:14 am

    This is what I ended up doing:

        results = None
        try:    
            connection = ldap.open(str(self.hostnameLineEdit.text()))
            connection.simple_bind_s(str(self.usernameLineEdit.text()), str(self.passwordLineEdit.text()))
            userDNSDomain = os.environ['USERDNSDOMAIN']
            userDNSDomain = userDNSDomain.split('.')
            base = ""
            for dc in userDNSDomain:
                base += "dc=" + dc + ","
            base = base[:-1]
            #print base
            resultID = connection.search(base,ldap.SCOPE_SUBTREE,'(objectClass=group)')
            resultTypes, results = connection.result(resultID, 0)
        except ldap.LDAPError, e:
            self.messageBox("LDAP Error: " + str(e))
        if results != None:
            while results[0][0] != None:
                #print results[0][1]['cn']
                self.groupsListWidget.addItem(QString(results[0][1]['cn'][0]))
                resultTypes, results = connection.result(resultID, 0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the ADLDAP library ( http://adldap.sourceforge.net ) to interact with Active Directory. I
Using this page, http://developer.android.com/sdk/compatibility-library.html , I have installed the Android Support Package, added a
I'm using this library for Facebook graph API access within my codeigniter project: http://www.haughin.com/code/facebook/
I am using this library for implementing coverflow in my app http://www.chaosinmotion.com/flowcover.html Now I
I'm using this java script library to show ratings http://www.fyneworks.com/jquery/star-rating/#tab-Overview . I'm using below
I am using the hector HOM library to access my cassandra datastore. This library
I'm using a open-source Python library in my project. This library logs a lot
I am using this library http://www.codeproject.com/KB/cs/tsnewlib.aspx to try and schedule tasks for Windows 7.
I am using this library (PHP Simple HTML DOM parser) to parse a link,
I have built a multilingual website with CodeIgniter using this library: http://codeigniter.com/wiki/URI_Language_Identifier/ I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.