View multiple MAC addresses in advanced JSS search

heathjw
New Contributor

This should be simple:

I am trying to provide a master inventory to our Technology director with all the system specs as well as user and asset information. All the system specs are easy: I do a saved search and select no criteria (selecting all), then select the applicable display fields. Then search into a csv. Easy! We are on Casper 7.1

The problem is this: I would like the excel sheet that I provide to show both the ethernet AND the airport MAC addresses, but there is no checkbox for multiple MAC's or MAC 1 and MAC 2, just "MAC Address." I spoke with JAMF and they told me there are a few options: submit a feature request, or, use terminal to dump the Airport MAC into a field (like Room or Phone) in the JSS. This would take a bit of research, plus I currently use all of those fields. I thought there must be a way to export that information (the MAC from en1, in most cases) for all my machines from the MySQL database. Or maybe something even easier.

Just wondering if anyone has a way to get information from the JSS into a CSV where there is no option under Display Field in saved searches. Again, it's simple, but any help is appreciated. Thanks.

- Jay Heath

Fieldston Lower
jheath at ecfs.org

6 REPLIES 6

Not applicable

We use a custom report to get the Airport MAC address.
I have attached it here - you may have to modify it as it only shows you the
computer name, Ethernet MAC address, and Airport MAC address.

Or you may be able to get all the info by:
1) export all the information that you can they way you are now.
2) export the ethernet mac and airport mac with the attached report.
3) use excel (or filemaker) to import the airport address by matching the
ethernet mac address.

Hope this helps.
--Brad Rellinger
Technology Specialist
Anthony Wayne Local Schools K-12
aw_aca_bre at nwoca.org

tlarkin
Honored Contributor

This could be done via simple shell script as well....here is a quick example I just whipped up.

######################## #!/bin/bash

nic=/usr/sbin/networksetup -getmacaddress Ethernet | awk '/ / { print $3 }'

aport=/usr/sbin/networksetup -getmacaddress Airport | awk '/ / { print $3 }'

#now write to a file

/bin/echo "Ethernet MAC is $nic, Airport MAC is $aport" > /Library/Receipts/macadd.txt

exit 0 ##############################



Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry: 913-449-7589
office: 913-627-0351

tlarkin
Honored Contributor

Not enough coffee yet, you need to add back ticks to those variables for it to work....

Bukira
Contributor

you could also add the computer name so you could identify later

Criss Myers
Senior Customer Support Analyst (Mac Services)
Apple Certified Technical Coordinator v10.5
LIS Business Support Team
Library 301
University of Central Lancashire
Preston PR1 2HE
Ex 5054
01772 895054

tlarkin
Honored Contributor

Yeah OK, so since Criss added that I will just rewrite it real quick. I had a few more sips of coffee. Back ticks now included.

######################## #!/bin/bash

nic=/usr/sbin/networksetup -getmacaddress Ethernet | awk '/ / { print $3 }'

aport=/usr/sbin/networksetup -getmacaddress Airport | awk '/ / { print $3 }'

cname=/usr/sbin/networksetup -getcomputername

#now write to a file

/bin/echo "$cname has Ethernet MAC of $nic, and Airport MAC of $aport" > /Library/Receipts/macadd.txt

exit 0 ##############################

tlarkin
Honored Contributor

Actually, now that I think about it, if you wanted to do this in a fashion where you could get a centralized. I tested this and it worked on one machine, but I didn't go much further. This is juts proof of concept.

#!/bin/bash

############ # this script is meant for building a report # and writing certain information to a text file over the network # # this script will contain a username and password to mount a network share #############

#set the variables of the info we need

nic=/usr/sbin/networksetup -getmacaddress Ethernet | awk '/ / { print $3 }'

aport=/usr/sbin/networksetup -getmacaddress Airport | awk '/ / { print $3 }'

cname=/usr/sbin/networksetup -getcomputername

#not make sure that we can mount the network share to write to a text file #please edit this to reflect your environment

/bin/mkdir /Volumes/temp/

/sbin/mount -t afp afp://username:password@myserver.com/sharepoint /Volumes/temp/

#now make sure that the mount point is mounted #edit this line to reflect what should go here

mountpoint="/Volumes/temp/Sharepoint"

if [[ -e $mountpoint ]]

then /bin/echo "$cname, $nic, $aport" >> $mountpoint/report.txt

else exit 1

fi

exit 0

You could go further to unmount the share point when the script exits. I also used commas in the echo, that way when you go to import it in say a spread sheet, you can use the comma as a point to separate fields. Since I used the double >> it will keep adding lines to that text file. So then just set up a casper policy to run this script on every computer and it will mount the share, write to that file and then exit. You can of course go even further and add lots of more info. I am not sure how Casper does their reports under the hood, but I got to assume it is something similar. Of course I just tested this on my local machine, and it worked so it is just proof of concept.

Just FYI,

Tom



Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry: 913-449-7589
office: 913-627-0351