获取使用的.Net域中的计算机列表 [英] Get list of computers in a domain using .Net
本文介绍了获取使用的.Net域中的计算机列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用C#获取计算机名称列表中的域名?
解决方案
使用的System.DirectoryServices;
公共无效PrintComputersInDomain(字符串域名)
{
的DirectoryEntry DE =新的DirectoryEntry(LDAP://+域名);
de.Children.SchemaFilter.Add(电脑);
的foreach(在de.Children的DirectoryEntry C)
{
Console.WriteLine(c.Name);
}
}
从的 http://msmvps.com/blogs/siva/archive/2008/01/25/enumerating-电脑-IN-A-domain.aspx
How to get list of computer names in a domain using C# ?
解决方案
using System.DirectoryServices;
public void PrintComputersInDomain (string domainName)
{
DirectoryEntry de = new DirectoryEntry ("LDAP://" + domainName);
de.Children.SchemaFilter.Add ("computer");
foreach (DirectoryEntry c in de.Children)
{
Console.WriteLine (c.Name);
}
}
from http://msmvps.com/blogs/siva/archive/2008/01/25/enumerating-computers-in-a-domain.aspx
这篇关于获取使用的.Net域中的计算机列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文