开发者

Get computers in a workgroup

开发者 https://www.devze.com 2023-02-15 00:49 出处:网络
How can I query all accessible computers that are i开发者_如何学编程n a particular workgroup?You can use the active directory API - check the DirectoryEntry class (don\'t forget to add reference to Sy

How can I query all accessible computers that are i开发者_如何学编程n 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);
        }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消