wscript.echo "Looking für GC" dim oCont, oGC Set oCont = GetObject("GC:") For Each oGC In oCont strGCPath = oGC.ADsPath Next wscript.echo "strGCPath=" & strGCPath, 3 wscript.echo "Querying AD für Objects" & strGCPath Set oConnection = CreateObject("ADODB.Connection") Set oRecordset = CreateObject("ADODB.Recordset") Set oCommand = CreateObject("ADODB.Command") oConnection.Provider = "ADsDSOObject" 'The ADSI OLE-DB provider oConnection.Open "ADs Provider" oCommand.ActiveConnection = oConnection oCommand.Properties("Page Size") = 100 oCommand.CommandText = "<" & strGCPath & ">;" & _ "(mailnickname=*);" & _ "distinguishedName,ObjectClass,displayName,mail" & _ ";subtree" Set oRecordset = oCommand.Execute wscript.echo "Done Total Records found:" & oRecordset.recordcount do until oRecordset.EOF wscript.echo "---- Infos aus dem ADO-Recordset ----" wscript.echo "Klasse:" & lcase(join(oRecordset.Fields("ObjectClass"),",")) wscript.echo wscript.echo "distinguishedName:" & oRecordset.Fields("distinguishedName") wscript.echo "displayName :" & oRecordset.Fields("displayName") wscript.echo "Mail :" & oRecordset.Fields("mail") wscript.echo "---- Infos aus dem gebundenen Object ----" set oObject = GetObject("LDAP:// " & oRecordset.Fields("distinguishedName")) wscript.echo "name :" & oObject.name wscript.echo "SamAccountName:" & oObject.samAccountName oRecordset.MoveNext loop