Active Directory Queries: Compare and Contrast ADODB and GetObject methods

Posted on 2008-10-30
Last Modified: 2013-12-24
In my last question is was suggested that for large Active Directory databases that the ADODB method should be used over the GetObject method. I'm not sure I fully understand the difference between these methods.

Could someone please show some samples of these methods, comment on the code involved, and  elaboate as much as possible on when each is to be used?


Question by:JB4375
  • 3
  • 2
LVL 17

Assisted Solution

by:Jared Luker
Jared Luker earned 200 total points
ID: 22847328
When I'm trying to work with user objects, I use the ADODB method to get the users Distinguished Name.  Once I have the DN stored in a variable, I can use the GetObject method to get all of the properties of that particular object.

If there are 200 objects in an OU I'm trying to work with, it seems best to use the ADODB method inside a loop.  It allows me to cycle through the objects and then use GetObject to work with each object as it comes through the loop.

Does that help?

Author Comment

ID: 22847447
Ok... so I guess I got the complete wrong impression that the ADODB and the Get Object methods were mutually exclusive?
LVL 65

Accepted Solution

RobSampson earned 300 total points
ID: 22847605
They kind of work hand in hand.  You can get by with running ADODB queries to retrieve information, and it *does* enumerate a lot faster than many GetObject calls, but, if you want to change properties of object, you must "bind" to the object using GetObject, then modify the properties.

An article such as this show you both of these methods at work:

How Can I Standardize the Logon Name for All My Users?


PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.


Author Comment

ID: 22849390
Thanks for all the info guys. That really helped.

Author Closing Comment

ID: 31511924
Jared - Provided a clear and concise answer.

Rob- Provided a clear and concise answer as well, but with additional recommended article to illustrate further.
LVL 65

Expert Comment

ID: 22854472
No problem. Thanks for the grade.



Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now