We run the following on all macs with a wireless card as a offline policy via Casper at logout.
This script will:
- Enable the wireless service if it’s not been enabled.
- Clear any set DNS servers & search domains (can be turned off for 10.4, reasoning is that 10.5+ can receive DNS from DHCP)
- Turns off the wireless card.
The script itself has been built from a few scripts contained within Caspers Resource Kit & then modified for 10.7+ by myself.
2 thoughts on “How To: Turn off Wireless Card”
Thanks for this, used your 10.7 hackery and rewrote the setAirPortNetwork.sh
if [ “$SSID” == “” ]; then
echo “Error: The parameter ‘SSID’ is blank. Please specify a SSID.”
OS=`/usr/bin/sw_vers -productVersion | /usr/bin/colrm 5`
if [[ “$OS” < "10.6" ]]; then
echo "Setting airport SSID to $SSID…"
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z -A"$SSID" –password="$password"
checkWireless=$(networksetup -listallhardwareports | egrep "Hardware Port: (Air|Wi-)" | cut -c 16-)
# First we need to get the Wi-Fi device's name
wifiDevice=`/usr/sbin/networksetup -listallhardwareports | awk '/^Hardware Port: Wi-Fi/,/^Ethernet Address/' | head -2 | tail -1 | cut -c 9-`
echo "Turning off the Wireless for OS $OS…"
/usr/sbin/networksetup -setairportnetwork "$wifiDevice" "$SSID" "$password"