Extension Attribute - for Airport

Not applicable

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

9 REPLIES 9

Not applicable

Also forgot to mention you can search on this with the "like" command.

bentoms
Release Candidate Programs Tester

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

Not applicable

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

bentoms
Release Candidate Programs Tester

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

Not applicable

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

tlarkin
Honored Contributor

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

bentoms
Release Candidate Programs Tester

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

Not applicable

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

GabeShack
Valued Contributor III

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

Gabe Shackney
Princeton Public Schools