'========================================================================== ' ' VBScript: AUTHOR: Ed Wilson , msft, 1/12/2005 ' ' NAME: ' ' COMMENT: Key concepts are listed below: '1. Use as ADO search template. Uses LDAP query sentax '2.Put Name of your server in the position occupied by LONDON - that is '3.after '========================================================================== Option Explicit ' is used to force the scripter to declare variables 'On Error Resume Next ' is used to tell vbscript to go to the next line if it encounters an error Dim strQuery Dim objConnection Dim objCommand Dim objRecordSet strQuery = ";" _ & "(objectCategory=user);" _ & "name;" _ & "subtree" 'Name is field you want to select. SubTree is scope of search Set objConnection = CreateObject("ADODB.Connection") objConnection.Open "Provider=ADsDSOObject;" Set objCommand = CreateObject("ADODB.Command") objCommand.ActiveConnection = objConnection objCommand.CommandText = strQuery Set objRecordSet = objCommand.Execute Do Until objRecordSet.EOF Wscript.Echo objRecordSet.Fields("name") objRecordSet.MoveNext Loop objConnection.Close