Return MAC adress of Ethernet adapters

pjstjs1007
New Contributor

I am using the following to create an EA to return the Mac address of the Ethernet adapters but the field is blank. Any ideas as to what might be the cause?

!/bin/sh

USBMAC=$(networksetup -listallhardwareports | awk '/Hardware Port: USB /{getline; getline; print $NF}')

if [[ "$USBMAC" == "" ]]; then echo "<result>N/A</result>"
else echo "<result>$USBmac</result>"
fi

When I run networksetup -listallhardwareports | awk '/Hardware Port: USB /{getline; getline; print $NF}' directly on the Mac in question it does return the MAC address of the adapter.

1 REPLY 1

mm2270
Legendary Contributor III

When was the EA created? Just today? If so, have you run an inventory collection on any Mac yet? Because EA values only get populated when inventory is collected on each machine.