Skip to main content
Question

Extension Attribute to detect if autoproxy is on


Forum|alt.badge.img+12
  • Valued Contributor
  • 190 replies

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

4 replies

Forum|alt.badge.img+12
  • Author
  • Valued Contributor
  • 190 replies
  • March 10, 2015


davidacland
Forum|alt.badge.img+18
  • Valued Contributor
  • 1811 replies
  • March 10, 2015

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

1echo "on"

you need to use

1echo "<result>on</result>"

Forum|alt.badge.img+12
  • Author
  • Valued Contributor
  • 190 replies
  • March 10, 2015

That did the trick!!

Thanks David


davidacland
Forum|alt.badge.img+18
  • Valued Contributor
  • 1811 replies
  • March 10, 2015

Glad it worked!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings