Posted on 07-25-2022 05:29 PM
Hello Guys, I have been trying to disable the Ethernet / LAN connection to our end users and only enable WIFI but my script seems to be not working well. Do you mind sharing your scripts or changes from your end?
Here's my script that i also found here.
#!/bin/bash
validConnections=("Ethernet" "Wi-Fi" "USB Ethernet"
"Broadcom NetXtreme Gigabit Ethernet Controller"
"Display Ethernet"
"Thunderbolt Bridge"
"Thunderbolt Ethernet")
while read connection; do
if [[ $(echo "${validConnections[@]}" | grep "$connection") ]]; then
setting=$(networksetup -getautoproxyurl "$connection" | awk '/Enabled/{print $NF}')
if [[ "$setting" == "No" ]]; then
Disabled+=("$connection")
elif [[ "$setting" == "Yes" ]]; then
Enabled+=("$connection")
fi
fi
done < <(networksetup -listallhardwareports | awk -F': ' '/Hardware Port:/{print $NF}')
if [[ -z "${Disabled[@]}" ]]; then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi
Posted on 07-25-2022 09:34 PM
What you've posted is an Extension Attribute script, not a script you would use to make actual changes to endpoints. You can tell it's an Extension Attribute by the echo "<result>Yes</result>" and echo "<result>No</result>" lines. So all it's doing is outputting the result of checking if any connections are enabled/disabled or not. And furthermore, this line - networksetup -getautoproxyurl - means it's specifically checking if auto proxy URL is enabled/disabled for any of the connections. There's nothing in the script that would be disabling an Ethernet connection.
To do what you want, the script can be very simple. For example:
#!/bin/zsh
while read connection; do
/bin/echo "Disabling $connection"
/usr/sbin/networksetup -setnetworkserviceenabled "$connection" off
done < <(/usr/sbin/networksetup -listallhardwareports | /usr/bin/awk -F': ' '/Hardware Port:/{print $NF}' | /usr/bin/grep -i "Ethernet")
Posted on 07-28-2022 03:35 AM
A ethernet (Lan server) connection makes the WiFi disable automatically in windows 8.1. By switching on the WiFi manually let only WiFi to run for few moments and the WiFi goes off again.
Posted on 07-28-2022 03:34 AM
To disconnect your wired Ethernet connection, unplug your Ethernet cable from its jack. On the Windows taskbar (bottom, right), right-click the Wireless Network Connection icon and select Disable. On the menu bar (top, right), right click the wireless icon and select Turn AirPort Off.
07-28-2022 03:35 AM - edited 07-28-2022 03:36 AM
A ethernet (Lan server) connection makes the WiFi disable automatically in windows 8.1. By switching on the WiFi manually let only WiFi to run for few moments and the WiFi goes off again.