Posted on 02-09-2011 12:55 AM
Hello all,
I wrote another Extension Attribute and thought I'd share it. We needed a reliable way to report the mac address for Airport cards. We had laptops that were inventoried while on wireless. The "MAC Address 1" under hardware on the inventory would show the Mac address that was active during the recon. This switch would also happen if when we had devices register with PGP while connected over wireless. The PGP server would record the mac address of the airport card. So I quite accidentally stumbled across this today while looking for something else. Light bulb went off, I tried some things, and here we are. This Extension Attribute will report back the Airport mac address on the system. Hope others find it useful, either as it stands, or as an idea for creating their own. It's really a very simple one nothing flashy or complex. Look at the attached file, if you have any questions please let me know. I also did one for PCI slots for someone I can email that to if anyone wants. If you have any you created please share never know who might find it useful too.
Sean
--
Sean Gallagher
Sr. Platform Engineer
The Children's Hospital of Philadelphia
100 Penn Square East 7th Flr.
Phila, PA. 19107
267-426-2607
Posted on 02-09-2011 12:59 AM
Also forgot to mention you can search on this with the "like" command.
Posted on 02-09-2011 01:09 PM
Thanks sean.
Will this work if the Airport card is called airport (lower case) or if it's called something else.
In my experience networksetup is very picky with caps.
Regards,
Ben Toms
Posted on 02-09-2011 01:36 PM
Hey Tom,
It will work in lower case. I just did the upper case because it displayed
that way in the terminal, but lower case works too.
Sean
Posted on 02-09-2011 01:51 PM
Weird.
If you try to turn off the airport card & the capitilsation isn't correct it fails.
I'll have more of a look when possible.
Thanks for checking.
Regards,
Ben Toms
Posted on 02-09-2011 02:24 PM
Tom,
In my tests I tried it both Capitalized and lower case, airpot on, and
turned off. It retuned the correct value for me in every instance. What
exactly are you seeing?
Sean
Posted on 02-09-2011 02:54 PM
Can you guys post the code? In my experience when you use the -getinfo switch with networksetup it wants Airport to be capitalized.
Plus, depending on your model of Mac, you will have different results for which interface the Airport is.
Mac Mini, iMac, Macbook, and Macbook Pro should list Airport as en1
Macbook Air should be en0
Mac Pro should be en3 since they have dual nics.
If you added extra PC card NICs your results may differ. Perhaps a simple detection mechanism in the script would suffice for all configurations?
Thanks,
Tom
Posted on 02-09-2011 03:59 PM
Yep I need the detection.
Our images are modular, with the base os's being built on a g5 or macpro & we remove all but en1.
Our laptops tend to have the airport card disable even after running networksetup detectnewhardware.
As we run a post install script macbook airs fail to run the script as they cannot contact the jss as they do not have an en1.
I'm looking for a solution, then I'll knock up an applescript app to run after imaging before my postinstall to enable all devices.
Regards,
Ben Toms
Posted on 02-10-2011 01:50 PM
Tom,
Sorry I was delayed getting back to you. Here is the code I am using for the Ext attribute. I just started it using it Tuesday and so far it's ben working just fine. Any improvements would be welcome.
Sean
#!/bin/sh
#This script has been verified to work on OS X 10.5.8 - 10.6.6.
#Gets mac Address for Airport cards.
Airport=networksetup -getmacaddress Airport
echo '<result>'$Airport'</result>'
Posted on 02-04-2015 06:53 AM
Anyone know how to write this as a VBScript for windows to grab the mac address? I have one script written but it returns both hardwired and wireless and also all the brand names and such. I'm just looking to get the wifi mac address.
dim WMI: set WMI = GetObject("winmgmts:\.
ootcimv2")
dim Nads: set Nads = WMI.ExecQuery("Select * from Win32_NetworkAdapter where physicaladapter=true")
dim nad
for each Nad in Nads
if not isnull(Nad.MACAddress) then Wscript.Echo Nad.description, Nad.MACAddress
next
Gabe Shackney
Princeton Public Schools