Patrick,
Tuve que usar VBScript para escribir un archivo csv y obtener la información de todos... No soy un experto en VBScript, pero un compañero de trabajo tenía un script que pude modificar para mis necesidades:
Const ADS_SCOPE_SUBTREE = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CreateTextFile("UserFile.csv")
Set objFile = objFSO.OpenTextFile("UserFile.csv", 2)
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select EmployeeID, mail from 'LDAP://DC=whatever,DC=us'" & _
" where objectCategory='person' and objectClass='user' and employeeID = ' 99 '"
objCommand.Properties("Page Size") = 10
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
objFile.WriteLine("EmployeeID,Email")
Do Until objRecordset.EOF
If Not IsNull(objRecordset.Fields("mail").Value) Then
iRec = iRec + 1
objfile.write (objRecordset.Fields("EmployeeID") & ", ")
If InStr(objRecordset.Fields("mail"), "@") = 0 Then
objfile.write (", ")
Else: objfile.write (LCase(Left(objRecordset.Fields("mail"), InStr(objRecordset.Fields("mail"), "@") - 1)) & ", ")
End If
objfile.WriteLine ("")
End If
objRecordset.MoveNext
Loop
objFile.Close
msgbox "¡HECHO!"