I been looking through hundreds of websites and tried everything I know, just to get IP's for the hostnames I collect using this code:
I've seen many network scanners that works perfectly written in C#, C++ and VB.net but I can't get mine to work properly. Can anyone implement a code to my code or write a new piece of code that gets IP's, Domain name and hostnames?
Thanks in advance! :)
Code:
Public Function GetComputers() As String
Dim result(4) As String
' Get the domin name
Dim ipproperties As NetworkInformation.IPGlobalProperties = NetworkInformation.IPGlobalProperties.GetIPGlobalProperties()
Dim domain As String = ipproperties.DomainName
Dim domainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" + domain)
domainEntry.Children.SchemaFilter.Add("computer")
For Each computer As DirectoryEntry In domainEntry.Children
result(0) = computer.Name
result(1) = domain
itm = New ListViewItem(result)
ListView1.Items.Add(itm)
Next
Return result(4)
End FunctionThanks in advance! :)