Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


May 01, 1999

An ADSI Primer, Part 5: Using ADO to Script Fast ADSI Searches


RSS
View this exclusive article with VIP access -- click here to join |
See More Windows 2000 Articles Here | Reprints | Or sign up for our VIP Monthly Pass!

Editor's note: This article is the fifth part of a 12-part series about Active Directory Service Interfaces (ADSI). The series started in the January 1999 issue. Refer to previous installments for definitions and background information.

Microsoft's ADO technology features fast algorithms that let you quickly scan for database objects that match certain criteria, conduct database searches, and retrieve the results of searches (i.e., result sets). These same fast algorithms also let you update the retrieved data and return it to the database. Because Microsoft created an ADO database connector for ADSI (i.e., the ADO OLE DB connector), you can use ADO's database query technology on valid ADSI providers, such as Lightweight Directory Access Protocol (LDAP), and Novell Directory Services (NDS).

However, the ADO OLE DB connector is currently read-only, so many of the useful ADO methods for updating data aren't available. Until this situation changes, you can use ADO only for searching and retrieving. Despite the read-only limitation, using ADO technology is still a boon. Without it, you would have to recursively search a database for objects. . . .


Already a VIP member?
Please log on to view the full article

Why become a VIP member?

VIP-only online access
VIP CD delivered twice a year: offline access to the entire Windows IT Pro article library
Monthly issue of your choice of Windows IT Pro or SQL Server Magazine

Subscribe Now
Reader Comments
<P>This does NOT tell me what I want. I need a script that will tell me the PROPER [NAMES] of all the objects, and all fields/attributes for those objects; i.e., adsuser.name, adsuser.description, etc. "name" and "description" are two field names for the 'user' object, for example. What are all the other AD object names, and what are the field names associated with the various AD objects? How do I get a list of all those? Also, how do I do "write.file" instead of
"wscript.echo;" i.e., to get the results to go to a file (without prompting me
to press "OK", like these scripts do)?</P>

Jeff Mason March 10, 2004


Finding the proper names of objects is not very easy. Doing a search of technet will help find the names - although I had significant trouble locating the names as well.
Writing to a file can be done two ways, programatically and using msdos:
Dim ts
Dim fso
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
On Error Resume Next
fso.DeleteFile("C:\output.txt")
On Error Goto 0
Set ts = fso.OpenTextFile(strFileName,ForWriting,True) ' True means create the file
ts.WriteLine "Hello World"
ts.Close

OR you can run your file with cscript from the dow window:
cscript myscript.vbs > c:\output.txt
The cscript will make the echo's show up in text in msdos and the > c:\output.txt will write it out to the file.

Good Luck!



Anonymous User March 17, 2005 (Article Rating: )


weak

Anonymous User August 16, 2005 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Windows 7 Sets Sales Record

Microsoft CEO Steve Ballmer described Windows 7's first ten days of sales as "fantastic" while in Japan yesterday. ...


Related Events WinConnections and Microsoft® Exchange Connections

Concrete Ways to Make Sure Your SharePoint Deployment Doesn't Blow Up

Windows, Unix, Linux Interoperability

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement