Solved

Active Directory Queries: Compare and Contrast ADODB and GetObject methods

Posted on 2008-10-30
6
320 Views
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?

Thanks,

JB
0
Comment
Question by:JB4375
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
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?
0
 
LVL 1

Author Comment

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

Accepted Solution

by:
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?
http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar08/hey0325.mspx

Regards,

Rob.
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
LVL 1

Author Comment

by:JB4375
ID: 22849390
Thanks for all the info guys. That really helped.
0
 
LVL 1

Author Closing Comment

by:JB4375
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.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 22854472
No problem. Thanks for the grade.

Regards,

Rob.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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