Anyone know the networksetup command for Auto Proxy Discovery?

tomt
Valued Contributor

I can find the commands to change almost any setting except the one to just turn on or off the Auto Proxy Discovery for a network service.

This command will turn on the Automatic Proxy Configuration:
networksetup -setautoproxystate Ethernet on

But I cannot for the life of me find the one that will tick that first check box.

I've found the setting in the plist file for it.
File = /Library/Preferences/SystemConfiguration/preferences.plist
Entry = ProxyAutoDiscoveryEnable
Value = 1
There is a separate setting for each network interface you have enabled under Proxies.

I need to find the actual terminal command in order to script it for use on non-managed machines.

Any help would be greatly appreciated. I also posted this to the MacEnterprise list in case it seems familiar.

Tom

7 REPLIES 7

ClassicII
Contributor III

Great question and I think the answer is it can't be done. I looked and could not find a setting to be able to turn that on either. We currently turn it on with managed prefs. If you do find it please post the info.

tlarkin
Honored Contributor

Hey Everyone,

Have you tried looking at MCX templates, or the defaults command to write to that file? Alternatively, you could also use the networksetup command to create an array of enabled network interfaces, and then loop through that array and then apply your settings to each interface.

I hope that points you in the right direction.

Thanks,
Tom

TimT
Contributor

Hi All,

First post, new to Casper and am looking for a similar solution.

Tom, couldn't find an MCX template to toggle Auto Proxy Discovery on/off.

Which managed pref are people using to achieve this?

Many Thanks

T

sean
Valued Contributor

Lion, for Ethernet 1:

networksetup -setproxyautodiscovery "Ethernet 1" on

10.5 or 10.6

Applescript:
You'll need to use the UI scripting. You may find the UIElementInspector useful. You'll also need to ensure 'Enable access for assistive devices' is turned on. To turn it on:

touch /private/var/db/.AccessibilityAPIEnabled

Objective C: You could start by checking this out:
http://developer.apple.com/library/mac/#releasenotes/Networking/RN-CFNetwork/_index.html

tlarkin
Honored Contributor

OK, so this I think will work, at least it looks like it is possible from my Lion laptop.

First get the array of existing network services enabled:

$ networksetup -listallnetworkservices | grep -v "*"
Bluetooth DUN
Ethernet
FireWire
Wi-Fi
iPhone USB
Bluetooth PAN
JAMFSW VPN

You can then loop through that data and set the proxy auto discovery. You may want to limit your loop with a more robust `grep -v` pipe to exclude some services you do not wish to add, unless you want to add it to everything.

from the networksetup man page:

[-setproxyautodiscovery networkservice on | off]

If you get a working solution please post it back here so everyone knows.

Thanks,
Tom

alexmcclements
Contributor

I used the following script to enable auto proxy discovery for the modes of connection within our enterprise.

#!/bin/sh

networksetup -setproxyautodiscovery "Display Ethernet" on
networksetup -setproxyautodiscovery "USB Ethernet" on
networksetup -setproxyautodiscovery "Thunderbolt Ethernet" on
networksetup -setproxyautodiscovery "Wi-Fi" on

bentoms
Release Candidate Programs Tester

I have a collection of scripts that we use to set or unset the Automatic Proxy setting: https://macmule.com/2014/12/07/how-to-change-the-automatic-proxy-configuration-url-in-system-prefere...