Modify yourcompany to the domain name


Const ADS_SCOPE_SUBTREE = 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 distinguishedName from 'LDAP://cn=Configuration,DC=yourcompany,DC=com' " & "where objectClass='nTDSDSA'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & objRecordSet.Fields("distinguishedName").Value
objRecordSet.MoveNext
Loop






At 11:29 6/26/2003, you wrote:
Hello all,

Got a question about listing Domain Controllers from an ADSI LDAP call. I was wondering if anyone knew a call to list all domain controller for a domain and also if there was a way to list all the domain controller for just an OU. Any help would be
appreciated. I have looked all around but had a difficult time finding this.


Regards
Shaun Gillissen



------
You are subscribed as [EMAIL PROTECTED]
Web Interface: http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&text_mode=&lang=english
To unsubscribe send a blank email to %%email.unsub%%




------
You are subscribed as [EMAIL PROTECTED]
Web Interface: 
http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&text_mode=&lang=english
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to