资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

当前域的计算机名

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

如何列出当前域的计算机名?

网友回答:

发表者:CSTerry

http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=149991

发表者:asmallbee

play     with:      
     
  using     System;      
  using     System.DirectoryServices;      
     
  class     Class1      
  {      
        static     void     Main     (string[]     args)      
        {      
                        ShowLocalUsers();      
        }      
     
        public     static     void     ShowLocalUsers()      
        {      
        DirectoryEntry     root     =     new     DirectoryEntry("WinNT:");     //alternativ     WinNT://your_domain      
        DirectoryEntries     domains     =     root.Children;      
        domains.SchemaFilter.Add("domain");      
        foreach     (DirectoryEntry     domain     in     domains)      
        {      
                Console.WriteLine(domain.Name);      
                DirectoryEntries     computers     =     domain.Children;      
                computers.SchemaFilter.Add("computer");      
                foreach     (DirectoryEntry     computer     in     computers)      
                {      
                        Console.WriteLine("\t"     +     computer.Name);      
                        DirectoryEntries     users     =     computer.Children;      
                        users.SchemaFilter.Add("user");      
                        foreach     (DirectoryEntry     user     in     users)      
                        {      
                                Console.WriteLine("\t\t"     +     user.Name);      
                        }      
                }      
        }      
    }      
  }      
 


 

 
热门推荐笔记本: IBM笔记本
相关文章:
笔记本相关:
IT技术文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved