I need to write a script that would get hostname and all physical addresses on my local machine. It will be run on the several machines.
After some research I've found out that I can get hostname from the $HOSTNAME
variable and I also found getmac
command.
The problem with getmac
is that it returns all mac addresses (loopback, logical, etc.) without any clue about interface it uses. Here is my example output:
2C-27-D7-40-62-7A \Device\Tcpip_{A04C5C9D-CD41-48D1-8EC8-54128C70835C}
32-9D-DE-C7-3F-6D \Device\Tcpip_{EB38E492-9BEF-4F8F-98E6-C08716920461}
02-90-4C-4F-4F-50 \Device\Tcpip_{42DB7C91-BB9E-4BF4-B374-289F1BBA7AC6}
It gives me 3 mac addresses, from which only one is physical, but I don't see the way to decide which one. Could you please help me?