C#: Enumerating available DCs in the domain

  • Thread starter Thread starter nntp.broadband.rogers.com
  • Start date Start date
N

nntp.broadband.rogers.com

Hello

Could someone please point me to an example which demonstrates a c#
application which will list all the DCs in a domain, so that the user can
select which Domain Controller its selecting to read / update the active
directory.

Thank You
 
nntp.broadband.rogers.com said:
...list all the DCs in a domain

Another way to do it is to query the "masteredBy" attribute of the
domainDNS object. That attribute is an array of strings containing
the name of the NTDS Settings object for each domain controller in
the domain. The parent entry of each of these is the server entry
for the domain controller under CN=Sites in the configuration
container. You can read the dNSHostName attributes of the domain
controllers from these objects. Just remember to ignore any entries
without a dnsHostName, which occurs for a period after dcpromo on
a new server.

Clifford Heath.
 
Back
Top