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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

830 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