I'm writing an application that needs to get a list of computers (their names) on a network. The examples I've found all seem to query an ActiveDirectory on a server, which is not what I need.
Is there a way to get a list of computers on a server-less network using the .net 2.0 classes I've done this before in VB6 using API's, so would I have to do that in C# 2005 using System.Runtime.InteropServices, or can it be done with System.DirectoryServices
Thanks for any help with this.

Getting a list of computers on a network
Jelle O
Im not sure if this is what you are looking for but this code should get a list of computers on a given domain and put their names into an ArrayList:
string domain = "Whatever your domain is"; //--- u can also have that searched and found for you
ArrayList ALLCPU = new ArrayList ALLCPU();
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
}
}
James Ernst
There's also http://www.codeproject.com/useritems/Network_Computers.asp.
Gavan
Matthew Yang
Karl Tarbet
I was looking for a way to list the names of the computers on a network of any type, ie, not just ones on a domain, but also if the network is a plain Workgroup.
Couldn't get this one to work. Maybe because I don't have a domain, I'm on a normal home workgroup.
The other two had examples that I can use.
Thank you to you all for your help.