Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site

   

Subscribe to OutlookExchange
Anderson Patricio
Ann Mc Donough
Bob Spurzem
Brian Veal
Catherine Creary
Cherry Beado
Colin Janssen
Collins Timothy Mutesaria
Drew Nicholson
Fred Volking
Glen Scales
Goran Husman
Guy Thomas
Henrik Walther
Jason Sherry
Jayme Bowers
John Young
Joyce Tang
Justin Braun
Konstantin Zheludev
Kristina Waters
Kuang Zhang
Mahmoud Magdy
Martin Tuip
Michael Dong
Michele Deo
Mitch Tulloch
Nicolas Blank
Pavel Nagaev
Ragnar Harper
Ricardo Silva
Richard Wakeman
Russ Iuliano
Santhosh Hanumanthappa
Steve Bryant
Steve Craig
Todd Walker
Tracey J. Rosenblath
 
   

Searching the AD

Page 1 | Page 2

Conclusion

Using the methods outlined above, and in the included script, you can easily find a specific object by searching on a unique field like samAcccountName or get at properties of all objects that have a certain attribute.  Searching for objects in the AD is crucial for building almost any script or application that needs to work with the AD and examples here should provide the information you need to get started.

Included Script (SQLADSearch.vbs)

About the Author

Jason Sherry is a Windows Infrastructure Architect for Pro Exchange and specialized in the Active Directory, Exchange, system management and administration, and scripting.  Before coming to Pro Exchange he worked at NetIQ for five years, where he was a product manager in their administration and security product line.

Reference Information

Microsoft ADO and SQL Server Developer's Guide
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlsg/html/msdn_adosql.asp

Searching with ActiveX Data Objects (ADO)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/adsi/searching_with_activex_data_objects_ado.asp

AD search enumeration preferences
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/adsi/ads_searchpref_enum.asp

 

Searching the AD

Page 1 | Page 2

Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Stephen Bryant or Pro Exchange. OutlookExchange.Com, Stephen Bryant and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

Copyright Stephen Bryant 2008