473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

C#: Enumerating available DCs in the domain

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

Nov 16 '05 #1
3 1729
There is a handy piece of code in the following site:

http://www.codeproject.com/csharp/servercombobox.asp

I think you have to specify your servertype 0x00000008 , just to display the
Domain Controllers only. That is the value assigned in the enumeration
struct (steDomainController = 0x00000008)

Thanks
steDomainController = p.broadband.rogers.com" <he****@hemang.net> wrote in
message news:i6********************@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

Nov 16 '05 #2
More specifically this link:

http://www.codeproject.com/csharp/cs...kresources.asp

"nntp.broadband.rogers.com" <he****@hemang.net> wrote in message
news:i6********************@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

Nov 16 '05 #3
nntp.broadband.rogers.com wrote:
...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.
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Lyn | last post by:
Hi, This question may seem a bit academic... To learn more about Access VBA, I have been enumerating the properties of various form controls. This was mostly successful and I have learned a lot...
7
by: Rohan Ranade | last post by:
I am trying to implement a crawler in C# that scans all the shared folders in remote computers in a windows network. Are there classes in .NET to do this directly? Please help. Thank You. Rohan
3
by: Mark | last post by:
I have a server in a workgroup (called "wg"). Does anyone know how to find the name of the workgroup from code (pref c#)? I've trawled the newsgroups and the MSDN site for the right class / method...
6
by: Michael C | last post by:
Hi all, I am currently using a Win32 API call to NetServerEnum to enumerate all SQL Servers on an NT Domain. The function returns the names of all servers running SQL Server on the network, but...
0
by: Michael C | last post by:
Hi all, After a lot of research, I've come to some realizations about enumerating Named Instances of MSDE. NetServerEnum() Win32 API function doesn't work, SQL-DMO doesn't work, no standard...
5
by: Hemang Shah | last post by:
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...
3
by: Joe User | last post by:
Hi - I found the class below on another website (www.devx.com) and can't seem to figure out how to make a call to this class to retrieve the machines and put them in a listbox. I am definitely a...
0
by: wifetalks | last post by:
I'm enumerating the computers in the domain to a listview control on my form, but how do I include the comments. Like what you would see in Windows Explorer when you browse the domain. On our...
0
by: John | last post by:
Hello, i write this code (vs2005) for enumerating all users from a group.. But not it works.. if i set GroupSamAccountName = "Domain Users" i don't have any results.. Why?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.