Posted on 09-02-2014 03:56 AM
Hi,
We're a school and over the summer the I.T guys have changed the filtering and we no longer require the proxy details on all the clients.
How can i remove the proxy details from all the clients.
I've stopped the script that was entering the details for the proxy details, but now need to clear this on all the clients.
Thanks
Posted on 09-02-2014 06:00 AM
Try the below script.
#!/bin/sh
##########################################################################################
# Script to turn off all the proxies in all the network ports
##########################################################################################
IFS=$'
'
for nport in $(networksetup -listallnetworkservices | tail +2 );
do
networksetup -setproxyautodiscovery $nport off
networksetup -setautoproxystate $nport off
networksetup -setwebproxystate $nport off
networksetup -setsecurewebproxystate $nport off
networksetup -setftpproxystate $nport off
networksetup -setsocksfirewallproxystate $nport off
networksetup -setstreamingproxystate $nport off
done
Thanks & Regards,
Karthikeyan
Posted on 09-02-2014 06:35 AM
Great thanks!
Its ethernet that i need to clear. So do i change the lines to:
networksetup -setproxyautodiscovery ethernet off
Posted on 09-02-2014 06:37 AM
remove the "for" loop and change the $nport to Ethernet
Posted on 09-02-2014 06:39 AM
Thank you.
I just don't know much about scripts and trying to put it together to create a policy on JSS
Posted on 09-02-2014 06:40 AM
its more likely to be Ethernet, or possibly Ethernet 1 or Thunderbolt Ethernet, so my suggestion is you get the name with networksetup -listallnetworkservices |grep Ethernet, unless you know they are all just Ethernet because they are the same model.
also you will need to see what is turned on in the list to only do one. and if you are using an autoproxy its probably this command
Usage: networksetup -setautoproxystate <networkservice> <on off>
Set proxy auto-config to either <on> or <off>.
Posted on 09-02-2014 06:49 AM
Thanks nessts
When i run in terminal networksetup -setproxyautodiscovery ethernet off it does what i require.
I just now need to create it as a policy to deploy across the network.
At the moment the log is showing:
/usr/sbin/jamf is version 8.6
Executing Policy SC Setup Proxy Details...
Mounting afp://sc-srv-sc01-mac.sc.internal/CasperShare to /Volumes/CasperShare...
Running script SCProxySetupNoProxy.sh...
Script exit code: 2
Script result: /private/tmp/SCProxySetupNoProxy.sh: line 17: syntax error: unexpected end of file
Unmounting file server...
Posted on 09-02-2014 06:56 AM
#!/bin/sh
##########################################################################################
# Script to turn off all the proxies in Ethernet Port
##########################################################################################
nport=$(networksetup -listallnetworkservices | grep -i Ethernet)
networksetup -setproxyautodiscovery "$nport" off
networksetup -setautoproxystate "$nport" off
networksetup -setwebproxystate "$nport" off
networksetup -setsecurewebproxystate "$nport" off
networksetup -setftpproxystate "$nport" off
networksetup -setsocksfirewallproxystate "$nport" off
networksetup -setstreamingproxystate "$nport" off
Regards,
Karthikeyan
Posted on 09-02-2014 07:23 AM
Sorry i'm being really dumb here
When i try to run the script in Apple Script editor
I get a syntax error on the $ sign
I have it as this:
#!/bin/sh
##########################################################################################
# Script to turn off all the proxies in Ethernet Port
##########################################################################################
nport=$(networksetup -listallnetworkservices | grep -i Ethernet)
networksetup -setsecurewebproxystate Ethernet off
networksetup -setftpproxystate Ethernet off
Posted on 09-02-2014 07:32 AM
We did something similar this summer, though we left auto proxy discover on in case they go somewhere that uses a proxy. Here's a modified version of our script that may work for you:
#!/bin/sh
echo "Pausing 20 seconds before we begin in case machine is just booting..."
/bin/sleep 20
# HARDCODED VALUES ARE SET HERE
wired="Ethernet"
wireless="Wi-Fi"
usb="USB Ethernet"
display="Display Ethernet"
tbolt="Thunderbolt Ethernet"
# Detect network interfaces
usbAdapter=`/usr/sbin/networksetup -listallhardwareports | grep -i "Hardware Port: USB Ethernet"`
displayAdapter=`/usr/sbin/networksetup -listallhardwareports | grep -i "Hardware Port: Display Ethernet"`
tboltAdapter=`/usr/sbin/networksetup -listallhardwareports | grep -i "Hardware Port: Thunderbolt Ethernet"`
wiredAdapter=`/usr/sbin/networksetup -listallhardwareports | grep -i "Hardware Port: Ethernet"`
wifiAdapter=`/usr/sbin/networksetup -listallhardwareports | grep -i "Hardware Port: Wi-Fi"`
##############
## Ethernet ##
##############
if [ "$wiredAdapter" != "" ]; then
echo "Ethernet found, setting proxy settings"
/usr/sbin/networksetup -setproxyautodiscovery "$wired" off
/usr/sbin/networksetup -setv6off "$wired"
/usr/sbin/networksetup -setwebproxystate "$wired" off
/usr/sbin/networksetup -setftpproxystate "$wired" off
/usr/sbin/networksetup -setsecurewebproxystate "$wired" off
/usr/sbin/networksetup -setstreamingproxystate "$wired" off
/usr/sbin/networksetup -setsocksfirewallproxystate "$wired" off
/usr/sbin/networksetup -setgopherproxystate "$wired" off
fi
###########
## Wi-Fi ##
###########
if [ "$wifiAdapter" != "" ]; then
echo "Wi-Fi found, setting proxy settings"
/usr/sbin/networksetup -setproxyautodiscovery "$wireless" off
/usr/sbin/networksetup -setv6off "$wireless"
/usr/sbin/networksetup -setwebproxystate "$wireless" off
/usr/sbin/networksetup -setftpproxystate "$wireless" off
/usr/sbin/networksetup -setsecurewebproxystate "$wireless" off
/usr/sbin/networksetup -setstreamingproxystate "$wireless" off
/usr/sbin/networksetup -setsocksfirewallproxystate "$wireless" off
/usr/sbin/networksetup -setgopherproxystate "$wireless" off
fi
##################
## USB Ethernet ##
##################
if [ "$usbAdapter" != "" ]; then
echo "USB Ethernet found, setting proxy settings"
/usr/sbin/networksetup -setproxyautodiscovery "$usb" off
/usr/sbin/networksetup -setv6off "$usb"
/usr/sbin/networksetup -setwebproxystate "$usb" off
/usr/sbin/networksetup -setftpproxystate "$usb" off
/usr/sbin/networksetup -setsecurewebproxystate "$usb" off
/usr/sbin/networksetup -setstreamingproxystate "$usb" off
/usr/sbin/networksetup -setsocksfirewallproxystate "$usb" off
/usr/sbin/networksetup -setgopherproxystate "$usb" off
fi
#####################
## Display Adapter ##
#####################
if [ "$displayAdapter" != "" ]; then
echo "Display Adapter found, setting proxy settings"
/usr/sbin/networksetup -setproxyautodiscovery "$display" off
/usr/sbin/networksetup -setv6off "$display"
/usr/sbin/networksetup -setwebproxystate "$display" off
/usr/sbin/networksetup -setftpproxystate "$display" off
/usr/sbin/networksetup -setsecurewebproxystate "$display" off
/usr/sbin/networksetup -setstreamingproxystate "$display" off
/usr/sbin/networksetup -setsocksfirewallproxystate "$display" off
/usr/sbin/networksetup -setgopherproxystate "$display" off
fi
#########################
## Thunderbolt Adapter ##
#########################
if [ "$tboltAdapter" != "" ]; then
echo "Thunderbolt adapter found, setting proxy settings"
/usr/sbin/networksetup -setproxyautodiscovery "$tbolt" off
/usr/sbin/networksetup -setv6off "$tbolt"
/usr/sbin/networksetup -setwebproxystate "$tbolt" off
/usr/sbin/networksetup -setftpproxystate "$tbolt" off
/usr/sbin/networksetup -setsecurewebproxystate "$tbolt" off
/usr/sbin/networksetup -setstreamingproxystate "$tbolt" off
/usr/sbin/networksetup -setsocksfirewallproxystate "$tbolt" off
/usr/sbin/networksetup -setgopherproxystate "$tbolt" off
fi
Posted on 09-02-2014 07:32 AM
Hi,
Save the script as shell script and run it in terminal.... also if you mention only Ethernet, it will not change for Thunderbolt Ethernet... so add $nport instead of Ethernet in networksetup command.