How can I query all accessible computers that are in a particular workgroup?
You can use the active directory API - check the DirectoryEntry class (don't forget to add reference to System.DirectoryServices.dll
).
Here is a short example:
using (DirectoryEntry workgroup = new DirectoryEntry("WinNT://Workgroup"))
{
foreach (DirectoryEntry child in workgroup.Children)
{
Console.WriteLine(child.Name);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With