How to get list of computer names in a domain using C# ?
using System.DirectoryServices;
public void PrintComputersInDomain (string domainName)
{
DirectoryEntry de = new DirectoryEntry ("LDAP://" + domainName);
de.Children.SchemaFilter.Add ("computer");
foreach (DirectoryEntry c in de.Children)
{
Console.WriteLine (c.Name);
}
}
from http://msmvps.com/blogs/siva/archive/2008/01/25/enumerating-computers-in-a-domain.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With