so i got to remove the SSID from the preferred list but it still is connected to that SSID, is there anyway i could shut down wifi and turn it back on real quick. that way they could connect to the actual wifi i want them too. ?
script to remove them from wifi and add them back

Best answer by boberito
I actually have a script for doing just this. Set this up as a policy to run once on the computer to install it
https://github.com/boberito/jamfscripts/blob/master/RemoveGuest%20-%20LaunchDeamon.sh
You can replace GUEST with your wifi network you want to remove. YOURCOMPANY with whatever you want. And you can change the location to somewhere other than /usr/local/
This will install a launchdaemon that'll watch a the file that gets changed when you add a wifi network. Check if the specific network is added. Then it'll remove it, or if it's currently connected to that network it'll turn wifi off for a moment then remove it and back on.
#!/bin/sh
#Sets up a script and creates a launchdeamon that watches com.apple.airport.preferences.plist
#This changes whenever you join a network. If the Guest network is joined, then remove it and bop them off of it
##################
##CREATE SCRIPT###
##################
cat << EOF > /usr/local/removeGuest.sh
#!/bin/bash
#set interface name and network you're hunting for
interfaceName="Wi-Fi"
networkName="GUEST"
Adapter=$(networksetup -listallhardwareports | grep -A 1 "$interfaceName" | grep Device | awk '{print $2}')
if networksetup -listpreferredwirelessnetworks $Adapter | grep "$networkName"; then
echo "Guest Found"
ConnectedtoGuest=$(networksetup -getairportnetwork $Adapter | awk -F ":" '{ print $2 }' | cut -c 2-)
if [ "$ConnectedtoGuest" == "$networkName" ]; then
#Gotta disconnect first to remove it
networksetup -setairportpower $Adapter off
networksetup -removepreferredwirelessnetwork $Adapter "$networkName"
networksetup -setairportpower $Adapter on
else
networksetup -removepreferredwirelessnetwork $Adapter "$networkName"
fi
fi
EOF
########################
##CREATE LAUNCHDAEMON###
########################
cat << EOF > /Library/LaunchDaemons/com.YOURCOMPANY.removeguest.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.YOURCOMPANY.removeguest2</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/usr/local/removeGuest.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist</string>
</array>
</dict>
</plist>
EOF
chown root:wheel /usr/local/removeGuest.sh
chmod 755 /usr/local/removeGuest.sh
chown root:wheel /Library/LaunchDaemons/com.YOURCOMPANY.removeguest.plist
chmod 644 /Library/LaunchDaemons/com.YOURCOMPANY.removeguest.plist
launchctl load -w /Library/LaunchDaemons/com.YOURCOMPANY.removeguest.plist
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.