Tech Off Post

Single Post Permalink

View Thread: Computer names on network c#?
  • User profile image
    lesmemphis

    Hey, I got it working, was very close to your example:

    ArrayList nets = new ArrayList();
    
    DirectoryEntry entryPC;
    entryPC = new DirectoryEntry();
    entryPC.Path = "WinNT://domainName";
    
    foreach (DirectoryEntry child in entryPC.Children)
    {
       if (child.Name != "Schema")
       nets.Add(child.Name);
      }
    
    return nets;

     

    (obviously using System.DirectoryServices)

    Thanks!