Skip to main content
Solved

Secondary Mac Address - ( How To Export Data ) - Extension Attribute


Hugonaut
Forum|alt.badge.img+15

Didn't Find a Solution on here so I thought I would share mine that worked flawlessly.

Best answer by Hugonaut

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>"

View original
Did this topic help you find an answer to your question?

Hugonaut
Forum|alt.badge.img+15
  • Esteemed Contributor
  • April 20, 2018
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>"


bpavlov
Forum|alt.badge.img+18
  • Esteemed Contributor
  • April 20, 2018

This assumes that en1 will be consistently the same interface you expect. Just be aware of that.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • April 20, 2018

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>"

Hugonaut
Forum|alt.badge.img+15
  • Esteemed Contributor
  • April 20, 2018

Thank you for the insight & responses, updated my original post with what machines we are using and what this works on.

@bpavlov @mm2270


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings