返回顶部

收藏

vb.net列出当前计算机所在域中的所有计算机

更多
Public Function GetComputersInDomain(ByVal domainName As String) As List(Of String)
    Dim entry As DirectoryEntry = New DirectoryEntry("LDAP://" + domainName)
    Dim searcher As DirectorySearcher = New DirectorySearcher(entry)
    searcher.Filter = "(objectClass=computer)"
    Dim result As New List(Of String)
    For Each sr As SearchResult In searcher.FindAll
        result.Add(sr.GetDirectoryEntry().Name.ToString())

    Next
    Return result
End Function

标签:VB.Net,windows

收藏

0人收藏

支持

0

反对

0

发表评论