Skip to main content
Solved

EA to collect ethernet adapter MAC address

  • January 20, 2014
  • 2 replies
  • 22 views

dpertschi
Forum|alt.badge.img+19

For JSS 8.x-- Has anyone already developed EA's to collect ethernet adapter MAC addresses?

I'm not convinced all my client and support staff are giving me this information so that I can add them to the removable address list.

Best answer by mm2270

Yeah, we have ones or both. As with anything, there are probably a half dozen ways this can be done, and there may be better ways, but these work for us

USB Ethernet

#!/bin/sh

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

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

Thunderbolt Ethernet

#!/bin/sh

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

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

2 replies

mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • Answer
  • January 20, 2014

Yeah, we have ones or both. As with anything, there are probably a half dozen ways this can be done, and there may be better ways, but these work for us

USB Ethernet

#!/bin/sh

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

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

Thunderbolt Ethernet

#!/bin/sh

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

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

Forum|alt.badge.img+6
  • Contributor
  • July 2, 2020

Any ideas how to do this on iPad with Belkin LAN + PoE adapter?