Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Get IP's from hostnames in a domain..

$
0
0
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:

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 Function

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! :)

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>