Posted on 11-13-2014 10:32 AM
I am starting to see this message when i look at my smart group of Yosemite computers. Does anyone have any information to resolve or has anyone experienced this message lately??
Solved! Go to Solution.
Posted on 11-13-2014 10:54 AM
Yeah, we needed to completely rewrite that EA. The problem is that with the one from the template, it first gets the OS version number. When run on Yosemite, it only pulls "1" from the "10". Under say, Mavericks, it pulls a "9".
When it evaluates that it uses a less than comparison and says, if the OS version is lower than 5, look for the network setup binary in a different location (the one that pre 10.5 used) so of course on Yosemite it doesn't exist and fails.
Here is what our current EA looks like after changing it. We don't manage anything lower than 10.6 and I doubt most people out there do. I haven't checked to see if JSS 9.x includes a new version of that EA script in the templates, but if not, JAMF should update it accordingly.
#!/bin/sh
Wireless=$(networksetup -getairportnetwork $(networksetup -listallhardwareports | awk '/AirPort|Wi-Fi/{getline; print $NF}') | awk -F'Network: ' '{print $NF}')
if [[ "$Wireless" =~ "not associated" ]] || [[ "$Wireless" =~ "currently off" ]]; then
echo "<result>No current wireless network</result>"
else
echo "<result>$Wireless</result>"
fi
Posted on 11-13-2014 10:54 AM
Yeah, we needed to completely rewrite that EA. The problem is that with the one from the template, it first gets the OS version number. When run on Yosemite, it only pulls "1" from the "10". Under say, Mavericks, it pulls a "9".
When it evaluates that it uses a less than comparison and says, if the OS version is lower than 5, look for the network setup binary in a different location (the one that pre 10.5 used) so of course on Yosemite it doesn't exist and fails.
Here is what our current EA looks like after changing it. We don't manage anything lower than 10.6 and I doubt most people out there do. I haven't checked to see if JSS 9.x includes a new version of that EA script in the templates, but if not, JAMF should update it accordingly.
#!/bin/sh
Wireless=$(networksetup -getairportnetwork $(networksetup -listallhardwareports | awk '/AirPort|Wi-Fi/{getline; print $NF}') | awk -F'Network: ' '{print $NF}')
if [[ "$Wireless" =~ "not associated" ]] || [[ "$Wireless" =~ "currently off" ]]; then
echo "<result>No current wireless network</result>"
else
echo "<result>$Wireless</result>"
fi
Posted on 11-13-2014 12:06 PM
@jperkins01 I had the same problem this is the one I use at the moment.
#!/bin/sh
# Determine the OS version since the networksetup command differs on OS
OS=`/usr/bin/sw_vers -productVersion | /usr/bin/colrm 5`
# Attempt to read the current airport network for the current OS
if [[ "$OS" < "10.5" ]]; then
if [ -f /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/networksetup ]; then
result=`/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/networksetup -getairportnetwork | sed 's/Current AirPort Network: //g'`
else
result="The networksetup binary is not present on this machine."
fi
elif [ "$OS" == "10.5" ]; then
result=`/usr/sbin/networksetup -getairportnetwork | sed 's/Current AirPort Network: //g'`
elif [ "$OS" == "10.6" ]; then
result=`/usr/sbin/networksetup -getairportnetwork AirPort | sed 's/Current AirPort Network: //g'`
else
device=`/usr/sbin/networksetup -listallhardwareports | grep -A 1 Wi-Fi | awk '/Device/{ print $2 }'`
result=`/usr/sbin/networksetup -getairportnetwork $device | sed 's/Current Wi-Fi Network: //g'`
fi
# Ensure that AirPort was found
hasAirPort=`echo "$result" | grep "Error"`
# Report the result
if [ "$hasAirPort" == "" ]; then
echo "<result>$result</result>"
else
echo "<result>No AirPort Device Found.</result>"
fi
Posted on 01-13-2015 11:51 AM
How is this being implemented? Please forgive my vagueness but i am curious how to get our machines properly checking in again.
Posted on 06-02-2015 04:07 PM
@jperkins01 I've actually switched to @mm2270 EA as listed above. I just add this to Management Settings > Extension Attributes
.
Posted on 06-03-2015 01:59 AM
There was a thread about incorrect EAs in Yosemite:
https://jamfnation.jamfsoftware.com/discussion.html?id=11666
Lots of people were writing scripts that would return 1 instead of 10. If you have a requirement to get this info, you'd probably be better off changing the cut to read:
cut -d "." -f 1,2
You could change to this:
cut -d "." -f 2
but then you could run into a similar problem if they come out with 11.1, etc
As for older OS versions. I believe I'm right in thinking any machines that are intel can run the following (so 10.4.4+ possibly?)
#!/bin/bash
wifi_network=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/' | cut -d ":" -f 2`
if [[ "$wifi_network" == "" ]]
then
echo "<result>No current wireless network</result>"
else
echo "$wifi_network"
fi
exit 0
@jhbush1973 You might like to check out 'case' instead of 'if'