How can I get a list of all computers in the local network?

  • Thread starter Thread starter Stanimir Angeloff
  • Start date Start date
S

Stanimir Angeloff

Hello there,



How can I get a list of all computers in the local network? The problem is
that it shouldn't use Active Directory. I tried this code (found at:
microsoft.public.dotnet.framework)



DirectorySearcher src = new DirectorySearcher("(objectClass=computer)");

foreach(SearchResult res in src.FindAll())

{

Console.WriteLine(res.Path);

}



But I get this error:



The specified domain either does not exist or could not be contacted



Thank you in advance ;)
 
Hello Frank Wisniewski.



Thank you for you reply.This tutorial is really great (the whole Code
Project is in fact great). This could be done using WMI, for more
information, please refer to WMI SDK.



Greetings, Stanimir Angeloff
 
Hey Stanimir,

I agree you could do this with WMI if you have active directory set up. In
my enviroment I do not have access to Active Directory so that is why I used
this example.

Frank
 
Back
Top