retrieve only active computers on the domain

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

I am using the following code to obtain all computers in my domain.
This returns all computers ever created in the domain. I would like to
only get currently active computers. Sort of like when you go into
Server Manager and it displays an active icon next to the computer
indicating that it is logged into the domain. Any help would be
appreciated.

private DirectoryEntry deDOMAIN = new
DirectoryEntry("WinNT://MYDOMAIN");

DirectoryEntries _myDcn = deDOMAIN.Children;

foreach(DirectoryEntry d in _myDcn)
{
if (d.SchemaClassName == "Computer")
treeView1.Nodes[0].Nodes.Add(new TreeNode(d.Name));
}
 
Greg, if you can ip of a host you can check is it active or not.
look at the direction of netapi32 functions like
NetShareEnum, etc..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top