Skip to main content
Solved

macOS wifi Extension attributes

  • July 29, 2025
  • 13 replies
  • 474 views

dmccluskey
Forum|alt.badge.img+8

With 15.6 and beta macos 26

The EA I was using for report back a macs SSID is now broken/blocked.

Does any happed to have one that will works?

 

Thanks

 

#!/bin/sh

# Jamf Extension attribute to return SSID
#
# Check for SSID name
wifi_name=$(ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}')

# Check if SSID is found
if [ -z "$wifi_name" ]; then
    result="No Wi-Fi network found."
else
    result="$wifi_name"
fi

# Result for Jamf
echo "<result>$result</result>"

 

 

 

 

Best answer by DPop

BigMacAdmin on Slack suggested this command: 

/usr/libexec/PlistBuddy -c 'Print :0:_items:0:spairport_airport_interfaces:0:spairport_current_network_information:_name' /dev/stdin <<< "$(system_profiler SPAirPortDataType -xml)" 2> /dev/null

This however takes a few seconds to run, so if anyone finds a better way please share.



Here is the script for the EA if anyone needs it.
 

#!/bin/bash

# Jamf Extension attribute to return SSID

#

# Get the current Wi-Fi SSID using system_profiler and PlistBuddy

wifi_name=$(/usr/libexec/PlistBuddy -c 'Print :0:_items:0:spairport_airport_interfaces:0:spairport_current_network_information:_name' /dev/stdin <<< "$(system_profiler SPAirPortDataType -xml)" 2> /dev/null)

# Check if SSID is found

if [ -z "$wifi_name" ]; then

    result="No Wi-Fi network found."

else

    result="$wifi_name"

fi

# Result for Jamf

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

 

13 replies

DPop
Forum|alt.badge.img+2
  • New Contributor
  • Answer
  • July 29, 2025

BigMacAdmin on Slack suggested this command: 

/usr/libexec/PlistBuddy -c 'Print :0:_items:0:spairport_airport_interfaces:0:spairport_current_network_information:_name' /dev/stdin <<< "$(system_profiler SPAirPortDataType -xml)" 2> /dev/null

This however takes a few seconds to run, so if anyone finds a better way please share.



Here is the script for the EA if anyone needs it.
 

#!/bin/bash

# Jamf Extension attribute to return SSID

#

# Get the current Wi-Fi SSID using system_profiler and PlistBuddy

wifi_name=$(/usr/libexec/PlistBuddy -c 'Print :0:_items:0:spairport_airport_interfaces:0:spairport_current_network_information:_name' /dev/stdin <<< "$(system_profiler SPAirPortDataType -xml)" 2> /dev/null)

# Check if SSID is found

if [ -z "$wifi_name" ]; then

    result="No Wi-Fi network found."

else

    result="$wifi_name"

fi

# Result for Jamf

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

 


DPop
Forum|alt.badge.img+2
  • New Contributor
  • September 24, 2025

Here is an updated script that works for macOS 26 devices, seems Apple will change the ability to get the SSID via terminal and will most likely remove it at some point. 

#!/bin/bash

# Enable verbose mode for ipconfig
sudo ipconfig setverbose 1

# Get the current SSID and display it for interface en0
SSID=$(ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}')

# Check if SSID is found
if [ -n "$SSID" ]; then
echo "Connected SSID: $SSID"
else
echo "SSID not found or not connected."
fi

# Result for Jamf
echo "<result>$SSID</result>"

Enjoy!


chris_kemp
Forum|alt.badge.img+20
  • Jamf Heroes
  • September 24, 2025

Might also be a good idea to follow that with a “sudo ipconfig setverbose 0” to restore the redaction.


benshawuk99
Forum|alt.badge.img
  • New Contributor
  • December 7, 2025

Very annoying behaviour from Apple to block all these APIs.  Especially as this info is clearly available in the system preferences.

Luckily they forgot about the WiFi scan cache, so I’m fudging around this like so:

 

#!/bin/bash

# macOS Tahoe WiFi SSID extraction
# Apple redacts SSID from all public APIs, but the CachedScanRecord
# in scutil still contains the actual network data in a binary plist!

get_ssid_from_scutil() {
local hex_data xml_data

# Query scutil for the AirPort state (contains CachedScanRecord)
hex_data=$(scutil <<EOF 2>/dev/null | grep "CachedScanRecord" | sed 's/.*<data> 0x//'
open
show State:/Network/Interface/en0/AirPort
quit
EOF
)

[[ -z "$hex_data" ]] && return

# Decode hex → binary plist → XML, then extract SSID-like strings
xml_data=$(echo "$hex_data" | xxd -r -p | plutil -convert xml1 -o - - 2>/dev/null)

# Filter for network names: starts with letter, no underscores, not all-caps technical keys
echo "$xml_data" \
| grep -oE '<string>[A-Za-z][A-Za-z0-9 -]{1,31}</string>' \
| sed 's/<[^>]*>//g' \
| grep -v '^[A-Z][A-Z]' \
| grep -v '^[A-F0-9]\{12\}$' \
| grep -vi 'Quantenna\|Topaz\|Broadcom\|Intel\|Realtek\|Atheros\|Mediatek' \
| head -1
}

# Get the SSID
SSID=$(get_ssid_from_scutil)

# Fallback if extraction failed
if [[ -z "$SSID" ]]; then
CHANNEL=$(system_profiler SPAirPortDataType 2>/dev/null | awk '
/^ *Current Network Information:/ { in_curr=1; next }
in_curr && /^ *Channel:/ { print $2; exit }
')

case "$CHANNEL" in
[1-9]|1[0-3]) SSID="WiFi (2.4GHz)" ;;
3[6-9]|[4-9][0-9]|1[0-6][0-9]) SSID="WiFi (5GHz)" ;;
*) SSID="WiFi (?)" ;;
esac
fi

echo "$SSID"

 


Person
Forum|alt.badge.img+11
  • Jamf Heroes
  • December 9, 2025

@DPop I just saw this, i have been using that slow version as  work around but going to setverbose 1 temporarily to pull it for certain scripts until Apple probbably removes it as well.


JevermannNG
Forum|alt.badge.img+8
  • Valued Contributor
  • December 10, 2025

I use the following Script which also lists an active LAN Device. Thanks to ​@dan-snelson to find the SSID name.

 

#!/bin/sh

####################################################################################################
#
# A Jamf Pro EA which determines the Mac's currently selected network interface.
#
####################################################################################################
#
# Based on a EA Script from Dan K. Snelson (@dan-snelson)
#
####################################################################################################

function currentSSID() {
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/
wirelessInterface=$( networksetup -listnetworkserviceorder | sed -En 's/^\(Hardware Port: (Wi-Fi|AirPort), Device: (en.)\)$/\2/p' )
ipconfig setverbose 1
SSIDname=$( ipconfig getsummary "${wirelessInterface}" | awk -F ' SSID : ' '/ SSID : / {print $2}')
ipconfig setverbose 0
}

# Get the list of active devices from scutil
active_devices=$(/usr/sbin/scutil --nwi | awk -F': ' '/Network interfaces:/{print $NF}')

# Loop over the list of active devices
for device in $(printf '%s\n' "$active_devices"); do
if [[ ! "$device" =~ "utun" ]]; then
# Get the name of the port associated with the device id, such as "Wi-Fi"
port_name=$(/usr/sbin/networksetup -listallhardwareports | grep -B1 "$device" | awk -F': ' '/Hardware Port:/{print $NF}')
# Add that name into an array
port_names+=("$port_name")
fi
done

# Prepare the Result
ActiveNetworkInterface="Missing"
ActiveNetworkInterface=$(printf '%s\n' "${port_names[@]}")
if [[ "$ActiveNetworkInterface" = "" ]]; then
result="Missing"
elif [[ "$ActiveNetworkInterface" =~ "Wi-Fi" ]]; then
currentSSID
result="$ActiveNetworkInterface - $SSIDname"
else
result="$ActiveNetworkInterface"
fi

# Print back the array as the returned value
echo "<result>$result</result>"

 


benshawuk99
Forum|alt.badge.img
  • New Contributor
  • December 10, 2025

I use the following Script which also lists an active LAN Device. Thanks to ​@dan-snelson to find the SSID name.

 

See, that still gives me:
<result>Wi-Fi - <redacted></result>

Hence my other hacky solution to pull the name from the scan cache..


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • December 11, 2025

With all the posts thanking ​@dan-snelson nobody has actually posted the link to his multiply updated blog post regarding Apple’s Wi-Fi Hide-And-Seek fascination, and a working EA so here it is: https://snelson.us/2024/09/determining-a-macs-ssid-like-an-animal/


JevermannNG
Forum|alt.badge.img+8
  • Valued Contributor
  • December 11, 2025

I use the following Script which also lists an active LAN Device. Thanks to ​@dan-snelson to find the SSID name.

 

See, that still gives me:
<result>Wi-Fi - <redacted></result>

Hence my other hacky solution to pull the name from the scan cache..

Well, you have to run the script as Root … it works :-)


JevermannNG
Forum|alt.badge.img+8
  • Valued Contributor
  • December 11, 2025

With all the posts thanking ​@dan-snelson nobody has actually posted the link to his multiply updated blog post regarding Apple’s Wi-Fi Hide-And-Seek fascination, and a working EA so here it is: https://snelson.us/2024/09/determining-a-macs-ssid-like-an-animal/

I needed an EA which lists all current Network Interfaces, see Dans comment in his script, he got help by someone else :-)


dan-snelson
Forum|alt.badge.img+30
  • Honored Contributor
  • December 11, 2025

With all the posts thanking ​@dan-snelson nobody has actually posted the link to his multiply updated blog post regarding Apple’s Wi-Fi Hide-And-Seek fascination, and a working EA so here it is: https://snelson.us/2024/09/determining-a-macs-ssid-like-an-animal/

Thanks, ​@sdagley!


benshawuk99
Forum|alt.badge.img
  • New Contributor
  • December 11, 2025

oops, this does actually work as root.  Doh!
Thanks, ​@JevermannNG 


benshawuk99
Forum|alt.badge.img
  • New Contributor
  • December 11, 2025

I use the following Script which also lists an active LAN Device. Thanks to ​@dan-snelson to find the SSID name.

 

See, that still gives me:
<result>Wi-Fi - <redacted></result>

Hence my other hacky solution to pull the name from the scan cache..

Well, you have to run the script as Root … it works :-)



Doh!  You’re right, it works as root!  Thank you!  :)
(Sorry, was testing in a non-MDM environment)