Posted on 09-10-2012 07:05 PM
Hi,
This will tick the auto proxy discovery tickbox in 10.6.X machines.
#!/bin/bash
# Mac OS X 10.6.X
# Date: 09/2012
# Author: Isaac Bayssari
# This will tick the auto proxy discovery tick box for 10.6.X machines.
echo "list Setup:/Network/Service/[^/]+/Proxies" | scutil | awk '{print $4}' | cut -c 24-59 | while read serviceid; do /usr/libexec/PlistBuddy -c "Add :NetworkServices:$serviceid:Proxies:ProxyAutoDiscoveryEnable integer 1" /Library/Preferences/SystemConfiguration/preferences.plist ;/usr/libexec/PlistBuddy -c "Set :NetworkServices:$serviceid:Proxies:ProxyAutoDiscoveryEnable 1" /Library/Preferences/SystemConfiguration/preferences.plist; done
Please email me if you would like a copy of this script.
ibayssari2@parra.catholic.edu.au
Solved! Go to Solution.
Posted on 09-10-2012 11:23 PM
Hi tim,
My Post Title Should Read "SOLVED:Ticking Auto Proxy Discovery in 10.6.X"
My post is putting a tick within the "Auto Proxy Discovery". The below and above script does this.
#!/bin/bash
# Mac OS X 10.6.X
# Date: 09/2012
# Author: Isaac Bayssari
# This will tick the auto proxy discovery tick box for 10.6.X machines.
echo "list Setup:/Network/Service/[^/]+/Proxies" | scutil | awk '{print $4}' | cut -c 24-59 | while read serviceid; do /usr/libexec/PlistBuddy -c "Add :NetworkServices:$serviceid:Proxies:ProxyAutoDiscoveryEnable integer 1" /Library/Preferences/SystemConfiguration/preferences.plist ;/usr/libexec/PlistBuddy -c "Set :NetworkServices:$serviceid:Proxies:ProxyAutoDiscoveryEnable 1" /Library/Preferences/SystemConfiguration/preferences.plist; done
Please email me if you would like a copy of this script.
ibayssari2@parra.catholic.edu.au
Thanks
Posted on 09-10-2012 08:29 PM
Try script 1. Thanks Ben :)
http://macmule.com/2011/09/09/how-to-change-the-automatic-proxy-configuration-url-in-system-preferences-via-a-script/
Posted on 09-10-2012 11:23 PM
Hi tim,
My Post Title Should Read "SOLVED:Ticking Auto Proxy Discovery in 10.6.X"
My post is putting a tick within the "Auto Proxy Discovery". The below and above script does this.
#!/bin/bash
# Mac OS X 10.6.X
# Date: 09/2012
# Author: Isaac Bayssari
# This will tick the auto proxy discovery tick box for 10.6.X machines.
echo "list Setup:/Network/Service/[^/]+/Proxies" | scutil | awk '{print $4}' | cut -c 24-59 | while read serviceid; do /usr/libexec/PlistBuddy -c "Add :NetworkServices:$serviceid:Proxies:ProxyAutoDiscoveryEnable integer 1" /Library/Preferences/SystemConfiguration/preferences.plist ;/usr/libexec/PlistBuddy -c "Set :NetworkServices:$serviceid:Proxies:ProxyAutoDiscoveryEnable 1" /Library/Preferences/SystemConfiguration/preferences.plist; done
Please email me if you would like a copy of this script.
ibayssari2@parra.catholic.edu.au
Thanks
Posted on 09-11-2012 11:16 AM
i've found Bens script 1 to work for 10.6 and 10.8 specifying not on ticking it but also the location of the auto configuration file. To others looking i really would suggest Bens method.
Posted on 09-11-2012 03:03 PM
Ha ha ha Tim, my virtual Pimp!!
Posted on 02-14-2013 09:25 AM
Tkimpton - do you have script that runs both that you can share?
Posted on 02-15-2013 01:12 AM
link i posted.
This is what i use
#!/bin/sh
##################################################################################
#
# HISTORY
#
# Version: 1.0
#
# - Created by Ben Toms on Jul 28th, 2011
#
# Sets the "Automatic Proxy Configuration" url in System Preferences.
#
# For more info see:
# http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/networksetup.8.html
#
###################################################################################
# HARDCODED VALUES ARE SET HERE
autoProxyURL="file://localhost/proxy.pac"
# CHECK TO SEE IF A VALUE WAS PASSED FOR $4, AND IF SO, ASSIGN IT
if [ "$4" != "" ] && [ "$autoProxyURL" == "" ]; then
autoProxyURL=$4
fi
# Detects all network hardware & creates services for all installed network hardware
/usr/sbin/networksetup -detectnewhardware
IFS=$'
'
#Loops through the list of network services
for i in $(networksetup -listallnetworkservices | tail +2 );
do
# Get a list of all services beginning 'Ether' 'Air' or 'VPN' or 'Wi-Fi'
# If your service names are different to the below, you'll need to change the criteria
if [[ "$i" =~ 'Ether' ]] || [[ "$i" =~ 'Air' ]] || [[ "$i" =~ 'VPN' ]] || [[ "$i" =~ 'Wi-Fi' ]] ; then
autoProxyURLLocal=`/usr/sbin/networksetup -getautoproxyurl "$i" | head -1 | cut -c 6-`
# Echo's the name of any matching services & the autoproxyURL's set
echo "$i Proxy set to $autoProxyURLLocal"
# If the value returned of $autoProxyURLLocal does not match the value of $autoProxyURL for the interface $i, change it.
if [[ $autoProxyURLLocal != $autoProxyURL ]]; then
networksetup -setautoproxyurl $i $autoProxyURL
echo "Set proxy for $i to $autoProxyURL"
fi
fi
done
echo "Proxies All Present And Correct..."
unset IFS
Posted on 05-23-2013 01:02 PM
I thought I'd update this post with an edit of Ben's script. This should tick the Auto Proxy Discovery checkbox in 10.8.
This won't solve the OP's problem but at least it will provide an answer to those folks on later versions of the OS who find this thread via a Google search.
#!/bin/sh
# Detects all network hardware & creates services for all installed network hardware
/usr/sbin/networksetup -detectnewhardware
IFS=$'
'
#Loops through the list of network services
for i in $(networksetup -listallnetworkservices | tail +2 );
do
# Get a list of all services beginning 'Ether' 'Air' or 'VPN' or 'Wi-Fi'
# If your service names are different to the below, you'll need to change the criteria
if [[ "$i" =~ 'Ether' ]] || [[ "$i" =~ 'Air' ]] || [[ "$i" =~ 'VPN' ]] || [[ "$i" =~ 'Wi-Fi' ]] ; then
autoProxyDiscStatus=`networksetup -getproxyautodiscovery $i | awk '{ print $4 }'`
# Echo's the name of any matching services & the autoproxyURL's set
echo "$i Proxy set to $autoProxyDiscStatus"
# If the value returned of $autoProxyURLLocal does not match the value of $autoProxyURL for the interface $i, change it.
if [[ $autoProxyDiscStatus != On ]]; then
networksetup -setproxyautodiscovery $i On
echo "Set proxy for $i to On"
fi
fi
done
echo "Proxies All Present And Correct..."
unset IFS