Finding MAC Address

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • FR3AK

    Finding MAC Address

    Hi.

    does anyone have any idea of how to find the mac address of a remote
    networking device? I've worked with WMI and it works fine as long as the
    target machine is a Windows computer, however, i want to return the MAC
    address of ANY IP device on my network.

    right now, i have a totally inefficient way to return a mac address, but
    it's only by dropping to a command prompt and executing the ARP command (all
    within code....it's not as ugly as it sounds).

    executing ARP within a loop (range of IP's to scan) is not a practical
    solution. Has anyone had success in finding info on how to do this?

    thank you for your assistance.
    --
    Rick King
    csharp@royaline .com

    "To the Glory of God, The Father"



  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Finding MAC Address

    Rick,

    You can make a call to the GetIpNetTable function in the IP Helper API.
    It will allow you to get the IP to MAC-address mapping table. You can also
    call the SendARP function to make a request for the MAC address for a
    particular IP address.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "FR3AK" <trashcan@paiin dustries.com> wrote in message
    news:OcfmIvylDH A.3288@tk2msftn gp13.phx.gbl...[color=blue]
    > Hi.
    >
    > does anyone have any idea of how to find the mac address of a remote
    > networking device? I've worked with WMI and it works fine as long as the
    > target machine is a Windows computer, however, i want to return the MAC
    > address of ANY IP device on my network.
    >
    > right now, i have a totally inefficient way to return a mac address, but
    > it's only by dropping to a command prompt and executing the ARP command[/color]
    (all[color=blue]
    > within code....it's not as ugly as it sounds).
    >
    > executing ARP within a loop (range of IP's to scan) is not a practical
    > solution. Has anyone had success in finding info on how to do this?
    >
    > thank you for your assistance.
    > --
    > Rick King
    > csharp@royaline .com
    >
    > "To the Glory of God, The Father"
    >
    >
    >[/color]


    Comment

    • FR3AK

      #3
      Re: Finding MAC Address

      Thanks for your help.

      I believe the SendARP only works on win2k machines and above, so i'll try
      the GetIpNetTable function as you mentioned. :)

      The code i have is working, but it's taking about 2 minutes to query an
      entire subnet....i'm sure there's a better way to do this.

      Thanks again for your response.
      --
      Rick King
      rking@royaline. com

      "To the Glory of God, The Father"

      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
      message news:OjnIKkzlDH A.2200@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Rick,
      >
      > You can make a call to the GetIpNetTable function in the IP Helper[/color]
      API.[color=blue]
      > It will allow you to get the IP to MAC-address mapping table. You can[/color]
      also[color=blue]
      > call the SendARP function to make a request for the MAC address for a
      > particular IP address.
      >
      > Hope this helps.
      >
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - mvp@spam.guard. caspershouse.co m
      >
      > "FR3AK" <trashcan@paiin dustries.com> wrote in message
      > news:OcfmIvylDH A.3288@tk2msftn gp13.phx.gbl...[color=green]
      > > Hi.
      > >
      > > does anyone have any idea of how to find the mac address of a remote
      > > networking device? I've worked with WMI and it works fine as long as[/color][/color]
      the[color=blue][color=green]
      > > target machine is a Windows computer, however, i want to return the MAC
      > > address of ANY IP device on my network.
      > >
      > > right now, i have a totally inefficient way to return a mac address, but
      > > it's only by dropping to a command prompt and executing the ARP command[/color]
      > (all[color=green]
      > > within code....it's not as ugly as it sounds).
      > >
      > > executing ARP within a loop (range of IP's to scan) is not a practical
      > > solution. Has anyone had success in finding info on how to do this?
      > >
      > > thank you for your assistance.
      > > --
      > > Rick King
      > > csharp@royaline .com
      > >
      > > "To the Glory of God, The Father"
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...