Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  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. . . .

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 log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Microsoft: Save Money ... By Paying for Software

Microsoft this week adopted an interesting tactic in its long-running battle with open source software: Businesses looking to save money over the long haul should simply pay for software instead of moving to free, open source solutions. The rationale? ...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...

Command Prompt Tricks

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


Related Events 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 Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


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 Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing