Click to See Complete Forum and Search --> : Find networked computers
noble
Jan 29th, 2001, 08:49 AM
Is there a way to go out and search for all computers
on the network you are currently on and get the names of them?
Thanks in advance
Babbalouie
Jan 29th, 2001, 10:44 AM
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
noble
Jan 29th, 2001, 11:44 AM
thank you very much bababooey
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.