1. <legend id='1Nrk1'><style id='1Nrk1'><dir id='1Nrk1'><q id='1Nrk1'></q></dir></style></legend>

      <small id='1Nrk1'></small><noframes id='1Nrk1'>

      <tfoot id='1Nrk1'></tfoot>

      <i id='1Nrk1'><tr id='1Nrk1'><dt id='1Nrk1'><q id='1Nrk1'><span id='1Nrk1'><b id='1Nrk1'><form id='1Nrk1'><ins id='1Nrk1'></ins><ul id='1Nrk1'></ul><sub id='1Nrk1'></sub></form><legend id='1Nrk1'></legend><bdo id='1Nrk1'><pre id='1Nrk1'><center id='1Nrk1'></center></pre></bdo></b><th id='1Nrk1'></th></span></q></dt></tr></i><div id='1Nrk1'><tfoot id='1Nrk1'></tfoot><dl id='1Nrk1'><fieldset id='1Nrk1'></fieldset></dl></div>
        <bdo id='1Nrk1'></bdo><ul id='1Nrk1'></ul>

    1. Active Directory 中联机的计算机列表

      List of computers in Active Directory that are online(Active Directory 中联机的计算机列表)

      <small id='G2BhM'></small><noframes id='G2BhM'>

          • <legend id='G2BhM'><style id='G2BhM'><dir id='G2BhM'><q id='G2BhM'></q></dir></style></legend>
          • <tfoot id='G2BhM'></tfoot>
              <i id='G2BhM'><tr id='G2BhM'><dt id='G2BhM'><q id='G2BhM'><span id='G2BhM'><b id='G2BhM'><form id='G2BhM'><ins id='G2BhM'></ins><ul id='G2BhM'></ul><sub id='G2BhM'></sub></form><legend id='G2BhM'></legend><bdo id='G2BhM'><pre id='G2BhM'><center id='G2BhM'></center></pre></bdo></b><th id='G2BhM'></th></span></q></dt></tr></i><div id='G2BhM'><tfoot id='G2BhM'></tfoot><dl id='G2BhM'><fieldset id='G2BhM'></fieldset></dl></div>
              • <bdo id='G2BhM'></bdo><ul id='G2BhM'></ul>
                  <tbody id='G2BhM'></tbody>
              • 本文介绍了Active Directory 中联机的计算机列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用这段代码来输出我网络上所有计算机的列表(语言是 jscript.net,但它只是对 C# 的一个小操作).

                I'm using this snippet of code to output a list of all the computers on my network (the language is jscript.net, but it's just a small manipulation of C#).

                    var parentEntry = new DirectoryEntry();
                
                    parentEntry.Path = "WinNT:";
                    for(var childEntry in parentEntry.Children) {
                        if(childEntry.SchemaClassName == "Domain") {
                            var parentDomain = new TreeNode(childEntry.Name); 
                            this.treeView1.Nodes.Add(parentDomain);
                
                            var subChildEntry : DirectoryEntry;
                            var subParentEntry = new DirectoryEntry();
                            subParentEntry.Path = "WinNT://" + childEntry.Name;
                            for(subChildEntry in subParentEntry.Children) {
                                var newNode1 = new TreeNode(subChildEntry.Name);
                                if(subChildEntry.SchemaClassName == "Computer") {
                                    parentDomain.Nodes.Add(newNode1);
                                }
                            }
                        }
                
                    }
                

                我有两个问题:

                1) 非常慢.大约有 100 台计算机显示,加载大约需要 1 分钟.

                1) It is extremely slow. There's about 100 computers showing, and it takes about 1 minute to load.

                2) 我只想获取当前在线的计算机列表.

                2) I want to get only a list of computers that are currently online.

                这是可以做到的,因为我见过其他程序这样做,而且它们的速度要快得多,而且它们只能在线显示那些.

                This can be done because I've seen other programs doing it and they are much faster, also they're able to show only the ones online.

                我错过了什么吗?

                推荐答案

                我知道它有点老了,但对其他人来说...此代码段将在 2-3 秒内使用 AD 从域中返回 760 个计算机名称...显着的改进..享受!

                I know it's a bit old, but for others...this snippet will return a 760 computer names from a domain using AD within 2-3 seconds....a significant improvement....enjoy!

                    Friend Shared Function DomainComputers() As Generic.List(Of String)
                
                    ' Add a Reference to System.DirectoryServices
                
                    Dim Result As New Generic.List(Of String)
                
                    Dim ComputerName As String = Nothing
                    Dim SRC As SearchResultCollection = Nothing
                    Dim Searcher As DirectorySearcher = Nothing
                
                    Try
                
                        Searcher = New DirectorySearcher("(objectCategory=computer)", {"Name"})
                
                        Searcher.Sort = New SortOption("Name", SortDirection.Ascending)
                        Searcher.Tombstone = False
                
                        SRC = Searcher.FindAll
                
                        For Each Item As SearchResult In SRC
                            ComputerName = Item.Properties("Name")(0)
                            Result.Add(ComputerName)
                        Next
                
                    Catch ex As Exception
                
                    End Try
                
                    Return Result
                
                End Function
                

                这篇关于Active Directory 中联机的计算机列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Adding and removing users from Active Directory groups in .NET(在 .NET 中的 Active Directory 组中添加和删除用户)
                set equality in linq(在 linq 中设置相等)
                HashSet conversion to List(HashSet 转换为 List)
                How to set timeout for webBrowser navigate event(如何为 webBrowser 导航事件设置超时)
                Test whether two IEnumerablelt;Tgt; have the same values with the same frequencies(测试两个IEnumerablelt;Tgt;具有相同频率的相同值)
                How do you determine if two HashSets are equal (by value, not by reference)?(您如何确定两个 HashSet 是否相等(按值,而不是按引用)?)
                  <tbody id='Ana3H'></tbody>
                • <bdo id='Ana3H'></bdo><ul id='Ana3H'></ul>
                        <i id='Ana3H'><tr id='Ana3H'><dt id='Ana3H'><q id='Ana3H'><span id='Ana3H'><b id='Ana3H'><form id='Ana3H'><ins id='Ana3H'></ins><ul id='Ana3H'></ul><sub id='Ana3H'></sub></form><legend id='Ana3H'></legend><bdo id='Ana3H'><pre id='Ana3H'><center id='Ana3H'></center></pre></bdo></b><th id='Ana3H'></th></span></q></dt></tr></i><div id='Ana3H'><tfoot id='Ana3H'></tfoot><dl id='Ana3H'><fieldset id='Ana3H'></fieldset></dl></div>
                        <tfoot id='Ana3H'></tfoot>
                          <legend id='Ana3H'><style id='Ana3H'><dir id='Ana3H'><q id='Ana3H'></q></dir></style></legend>

                          <small id='Ana3H'></small><noframes id='Ana3H'>