PDA

Click to See Complete Forum and Search --> : Get all computer names in network IN c#


PPCC
May 19th, 2006, 02:20 AM
hi all
anybody workd on how to get all computer names in the network in c#
i was tring this code , but i am getting error.
can anybody help in this code or provide working code ..
using System.DirectoryServices;
string domain = "DomainNAme";
ArrayList ALLCPU = new ArrayList();
DirectoryEntry de = new DirectoryEntry(domain);
//Iterate through entries to find the Computer names
foreach (DirectoryEntry child in de.Children)
{
if (child.SchemaClassName == "Computer")
{
AllCPU.Add(child.Name);
// Or whatever else you want to do with them
}
}help in highly appreciated..

thanks & reg

PPCC

Hack
May 19th, 2006, 05:38 AM
What error message are you getting and what line of code is it on?