Collect information about SSID on iMac running BigSur via extension attribute

jamflund
New Contributor III

Hi!

Has anyone managed to get information about the iMac computer's SSID running MacOS BigSur via extensions attribute. If so, how did you do it?

Regards

2 ACCEPTED SOLUTIONS

bzuidema
New Contributor II

Hello,
This is what I have been using to get this information, it works on both M1 and Intel macs as well as all MacOS versions.

#!/bin/sh

##Get the wireless port ID
WirelessPort=$(networksetup -listallhardwareports | awk '/Wi-Fi|AirPort/{getline; print $NF}')

##Collect new preferred wireless network inventory and send back to the JSS
PreferredNetworks=$(networksetup -listpreferredwirelessnetworks "$WirelessPort" | sed 's/^   //g')

echo "<result>$PreferredNetworks</result>"

The results look like this

Preferred networks on en1:
Wireless1
Wireless2

 

View solution in original post

dlbrabb
New Contributor III

Here's the script that we use for the current SSID connected to:

#!/bin/sh
# Jamf Extension attribute to return SSID

result=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'`
echo "<result>$result</result>"

View solution in original post

4 REPLIES 4

bzuidema
New Contributor II

Hello,
This is what I have been using to get this information, it works on both M1 and Intel macs as well as all MacOS versions.

#!/bin/sh

##Get the wireless port ID
WirelessPort=$(networksetup -listallhardwareports | awk '/Wi-Fi|AirPort/{getline; print $NF}')

##Collect new preferred wireless network inventory and send back to the JSS
PreferredNetworks=$(networksetup -listpreferredwirelessnetworks "$WirelessPort" | sed 's/^   //g')

echo "<result>$PreferredNetworks</result>"

The results look like this

Preferred networks on en1:
Wireless1
Wireless2

 

jamflund
New Contributor III

Big thanks for sharing your script. Do you or someone else have any a clue how to to send back to JSS current wireless SSID which Mac use at the moment ?

dlbrabb
New Contributor III

Here's the script that we use for the current SSID connected to:

#!/bin/sh
# Jamf Extension attribute to return SSID

result=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'`
echo "<result>$result</result>"

jamflund
New Contributor III

I confirm that it also works on iMac and MacBook with BigSur. Wonderful people - thanks.