Didn't Find a Solution on here so I thought I would share mine that worked flawlessly.
THIS NOTE IS ADDED AFTER @bpavlov @mm2270 provided the below insight & comments
THIS WORKS FOR OLDER (late 2009 & up) MacBook Pro Models & The 2016 Air Models. Our en1 configured is configured for wifi & en0 is configured for ethernet. en0 being primary & en1 being secondary in our JSS.
Steps
Create an extension attribute with the following script & Wallah (can obvi replace en1 w/ whatever you want from the ifconfig options.
Once configured you can create an Advanced Computer Search and select your secondary mac address extension attribute and export =)
#!/bin/sh
result=`ifconfig en1 | grep ether | awk '{print $2}'`
echo "<result>$result</result>"
This assumes that en1 will be consistently the same interface you expect. Just be aware of that.
I don't know if hardcoding en1
or any other port id is necessarily a good idea. With some older models only having a built in Ethernet and some not having one at all, it might be better to get whatever the second "en" port is in the list and using that. Generally speaking, en0 will be Wi-Fi on most newer models and en1 would be something like a Thunderbolt connection. On older models, en0 will be Built-In Ethernet and en1 will be something else, but most times, you want the second en port since en0 is what Jamf uses for the "MAC Address" criteria.
#!/bin/bash
PORT=$(networksetup -listallhardwareports | awk '/Device: en/{print $NF}' | sort | sed -n 2p)
if [ ! -z "$PORT" ]; then
MACADD=$(ifconfig "$PORT" | awk '/ether/{print $2}' | tr '[a-z]' '[A-Z]')
else
MACADD=$(ifconfig en0 | awk '/ether/{print $2}' | tr '[a-z]' '[A-Z]')
fi
echo "<result>$MACADD</result>"
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.