After dealing with several options, most of them involving a call to a command line tool and parsing the output, which is not really elegant. Other solutions were based on obsolete VBScript client code and ActiveX, even worse.
Finally I found in the excellent pinvoke.net site a very nice and simple example using a simple call to iphlpapi.dll
’s SendARP method. The trick was to use ARP to get the MAC from the IP.
Note that this has it’s limitations, as I will only work if the remote machine is in the same network and the packet does not need to go through a router. I was enough for our needs.
Here’s the code I adapted from the example:
Enjoy!