Solved

Get remote IP or MAC

Posted on 2007-03-23
2
627 Views
Last Modified: 2013-12-17
I am trying to get the IP address or MAC id of a computer on the same lan.  I would like to use .NET calls to do this.  I found the following but it seems to require Admin rights to the computer.  Is there any way to do this without using windows API calls or a High Level Login. I would be alright with the ability to do it with a restricted domain user login though

I found the code here
http://www.experts-exchange.com/Programming/Languages/.NET/Q_21469047.html

    Public Shared Function GetMAC(ByVal ComputerName As String)
        Dim MAC As String = ""
        Try
            Dim query As String = "SELECT * FROM Win32_NetworkAdapterConfiguration"

            Dim searchAddresses As New ManagementObjectSearcher(query)
            Dim ConOpts As New ConnectionOptions()

            ConOpts.Password = "Pswd"
            ConOpts.Username = "Domain\LoginName"
            Dim SearchScope As ManagementScope = New ManagementScope("\\" & ComputerName & "\root\cimv2", ConOpts)
            searchAddresses.Scope = SearchScope

            Dim objColl As ManagementObjectCollection
            objColl = searchAddresses.Get()
            Debug.Print(objColl.ToString)
            For Each Adapter As ManagementObject In objColl
                If Adapter("MacAddress") IsNot Nothing Then
                    MAC = Adapter("MacAddress") '(0)
                End If
            Next
        Catch ex As Exception
            Debug.Print(ex.Message & vbCrLf & vbCrLf & ex.StackTrace)
        End Try

        Return IP
    End Function
0
Comment
Question by:Corey2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Corey2 earned 0 total points
ID: 18781937
I found it
Dim HostIP() As System.Net.IPAddress = System.Net.Dns.GetHostEntry(ForComputerName).AddressList
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question