Skip to main content

Hi all

I'm here to make you feel great about your scripting skills!

I've just cobbled this together to show if any of the network adapters have the proxy enabled,
saved as a script and run from my Mac it returns "on" if any of them are enabled, i'd like to use it as an EA so i can create a smart group from it, but when running recon after adding it to the extension attributes (pasting in as a script) it returns nothing, should this work as an EA or am i barking up the wrong tree ?

Cheers, Andy

!/bin/sh

Get proxy status

Declaring Variables

WiFi=/usr/sbin/networksetup -getautoproxyurl "Wi-Fi" | grep -x "Enabled: Yes"
USBEthernet=/usr/sbin/networksetup -getautoproxyurl "USB Ethernet" | grep -x "Enabled: Yes"
Broadcom_NetXtreme_Gigabit_Ethernet_Controller=/usr/sbin/networksetup -getautoproxyurl "Broadcom NetXtreme Gigabit Ethernet Controller" | grep -x "Enabled: Yes"
Display_Ethernet=/usr/sbin/networksetup -getautoproxyurl "Display Ethernet" | grep -x "Enabled: Yes"
Thunderbolt_Bridge=/usr/sbin/networksetup -getautoproxyurl "Thunderbolt Bridge" | grep -x "Enabled: Yes"
Thunderbolt_Ethernet=/usr/sbin/networksetup -getautoproxyurl "Thunderbolt Ethernet" | grep -x "Enabled: Yes"

Checking status

if [ "$WiFi" = "Enabled: Yes" ]; then echo "on"

fi

Checking status

if [ "$USBEthernet" = "Enabled: Yes" ]; then echo "on"

fi

Checking status

if [ "$Broadcom_NetXtreme_Gigabit_Ethernet_Controller" = "Enabled: Yes" ]; then echo "on"

fi

Checking status

if [ "$Display_Ethernet" = "Enabled: Yes" ]; then echo "on"

fi

Checking status

if [ "$Thunderbolt_Bridge" = "Enabled: Yes" ]; then echo "on"

fi

Checking status

if [ "$Thunderbolt_Ethernet" = "Enabled: Yes" ]; then echo "on"

fi


EAs use html tags for the output so you just need to alter the echo output. Instead of

echo "on"

you need to use

echo "<result>on</result>"

That did the trick!!

Thanks David


Glad it worked!