Posted on 03-10-2015 03:51 PM
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
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"
if [ "$WiFi" = "Enabled: Yes" ]; then echo "on"
fi
if [ "$USBEthernet" = "Enabled: Yes" ]; then echo "on"
fi
if [ "$Broadcom_NetXtreme_Gigabit_Ethernet_Controller" = "Enabled: Yes" ]; then echo "on"
fi
if [ "$Display_Ethernet" = "Enabled: Yes" ]; then echo "on"
fi
if [ "$Thunderbolt_Bridge" = "Enabled: Yes" ]; then echo "on"
fi
if [ "$Thunderbolt_Ethernet" = "Enabled: Yes" ]; then echo "on"
fi
Posted on 03-10-2015 03:58 PM
Posted on 03-10-2015 04:02 PM
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>"
Posted on 03-10-2015 04:11 PM
That did the trick!!
Thanks David
Posted on 03-10-2015 04:15 PM
Glad it worked!