DirectoryEntry root = new DirectoryEntry("WinNT:");
DirectoryEntries domains = root.Children;
domains.SchemaFilter.Add("domain");
foreach (DirectoryEntry domain in domains)
{
if (domain.Name.ToString() == "ADMIN")
{
DirectoryEntries computers = domain.Children;
computers.SchemaFilter.Add("computer");
foreach (DirectoryEntry computer in computers)
{
try
{
IPHostEntry iphe = Dns.GetHostByName(computer.Name); foreach (IPAddress ip in iphe.AddressList)
{
this.hostlist.Items.Add(computer.Name);
}
DirectoryEntries users = computer.Children;
}
catch (Exception) { }
}
}
}
} 该USING 啥呢? 编译不过
using System.DirectoryServices; 还不对?
DirectoryEntries domains = root.Children;
domains.SchemaFilter.Add("domain");
foreach (DirectoryEntry domain in domains)
{
if (domain.Name.ToString() == "ADMIN")
{
DirectoryEntries computers = domain.Children;
computers.SchemaFilter.Add("computer");
foreach (DirectoryEntry computer in computers)
{
try
{
IPHostEntry iphe = Dns.GetHostByName(computer.Name); foreach (IPAddress ip in iphe.AddressList)
{
this.hostlist.Items.Add(computer.Name);
}
DirectoryEntries users = computer.Children;
}
catch (Exception) { }
}
}
}
} 该USING 啥呢? 编译不过
using System.DirectoryServices; 还不对?
解决方案 »
- 求大神解答 MVC 向ORACLE数据库中插入数据 这句话return Entities.SaveChanges() >= 0;出错 为什么啊?
- 怎么得网页元素的位置?
- Power Shell
- 一个关于String SqlCmd = "SELECT * FROM dmcimage WHERE ImageNO=@ImageID";的问题·····
- 如何在一个窗口中查看另一窗口的控件的属性啊?
- 窗体运行是闪的厉害(特别是加载动态控件想波浪一样),如何解决?
- 为什么不用生成一个对象呢?
- 请教IP地址的正则表达式
- 急求c#与数据库的高手
- lkal4587 (舟遥遥以轻扬 风飘飘而吹衣) 等三兄弟,你们快回来吧
- InstallShield 打包的问题·郁闷了好几天了·
- 存储过程中的返回值的问题
2.IPHostEntry iphe = Dns.GetHostByName(computer.Name);
GetHostByName已经没有了,在2005里面应该用"GetHostEntry"
IPHostEntry iphe = Dns.GetHostEntry(computer.Name);
错误提示中都有,
IPHostEntry iphe = Dns.GetHostEntry(computer.Name);
已经改成这样了了。不报错,但 是没反映啊