Here's some code to find all the computers in a domain...not exactly what you were looking for, but no DLL required, either...
Code:Public Function GetComputersInADomain(aryUsers() As String) As Long 'Notes: Requires a global array to be pased in if list of users wanted 'Notes: Very slow if domain name not valid 'Notes: Must set reference to Active DS Type Library for this to work Dim TheDomain As IADsDomain Dim Computer As IADsComputer Dim strDomain As String Dim x As Long 'Accept the Domain name strDomain = InputBox("Domain Name: ") 'Use the WinNT Directory Services strDomain = "WinNT://" & strDomain 'Create the Domain object Set TheDomain = GetObject(strDomain) 'Search for Computers in the Domain TheDomain.Filter = Array("Computer") 'Enumerate each computer in the domain For Each Computer In TheDomain x = x + 1 ReDim Preserve aryUsers(x) aryUsers(x) = Computer.Name Next Computer 'Clean up GetComputersInADomain = x Set Computer = Nothing Set TheDomain = Nothing End Function


Reply With Quote