I am trying to get a list of local network computers. I tried to use NetServerEnum
and WNetOpenEnum
API, but both API return error code 6118
I made a function out of it. The SchemaClassName
has to be Computer
public List NetworkComputers()
{
return (
from Computers
in (new DirectoryEntry("WinNT:")).Children
from Computer
in Computers.Children
where Computer.SchemaClassName == "Computer"
orderby Computer.Name
select Computer.Name).ToList;
}