Liefert eine Liste aller Domain-Controller in einer Domain
/// <summary>
/// Liefert eine Liste aller Domain-Controller.
/// </summary>
public List<string> GetDCs()
{
System.DirectoryServices.ActiveDirectory.Domain Domain = System.DirectoryServices.ActiveDirectory.Domain.GetComputerDomain();
List<string> DCList = new List<string>();
foreach (System.DirectoryServices.ActiveDirectory.DomainController Server in Domain.DomainControllers)
{
DCList.Add(Server.Name);
}
return DCList;
}
Kommentare zum Snippet