2012-02-12

Get the MAC address of a remote computer

OK, this might really be very, very basic ... but it is still often useful.
How to get the MAC address of a remote computer (limitation: the computer must be on the same IP subnet) from a Windows command line?

Ping the computer (either the hostname or the IP address)
Then run arp -a
It will return a list of IP addresses and the associated MAC addresses.
Look for the line that has the IP of the computer in question and you have its MAC address.

Background:
We are making use of the ARP cache. The arp cache keeps track of the next (router-) hop to any given IP address. If there are no routers involved (i.e. on the same subnet) the MAC address of the computer is returned. If however the traffic needs to be routed then the MAC address of the next router is returned.