Created
October 25, 2016 18:41
-
-
Save krispayne/b3a7c5e469bae1cfdf85cffb9d39c1f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Extension attribute to find if bad network is on device | |
# Modified from: | |
# Lauren Caliolio 8/22/2014 | |
# Contact me: laurendc@gmail.com, twitter @laurendc or JAMFNation: laurendc | |
# Wireless network to hunt | |
HUNT="old-public-ssid" | |
# Find device on hardware irregardless of model | |
WIFI_DEVICE=$(/usr/sbin/networksetup -listallhardwareports | /usr/bin/egrep -A2 'Airport|Wi-Fi' | /usr/bin/awk '/Device/ { print $2 }') | |
# Get name of preferred wireless network that's first on the list | |
FIRST=$(/usr/sbin/networksetup -listpreferredwirelessnetworks $WIFI_DEVICE | /usr/bin/awk '{if (NR!=1) { print $1 }}' | /usr/bin/grep "${HUNT}") | |
if [[ ${FIRST} = ${HUNT} ]]; then | |
RESULT="True" | |
else | |
RESULT="False" | |
fi | |
/bin/echo "<result>"${RESULT}"</result>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment