Hello,
I need the community
I have a script, which create two Network Locations. The script work but finish with a error. I'm not sure why. Some settings the script add in the new network locations but not the important setting. We need to add the Auto URL Proxy Link.
Can everyone tell me why the script crashed and what I need to add the Proxy URL adress?
Here the script and the error what I get.
Script:
#! /bin/sh
####################################################################################################
#hardcoded variables
usb="USB Ethernet"
display="Display Ethernet"
tbolt="Thunderbolt Ethernet"
wired="Ethernet"
wireless="Wi-Fi"
btDUN="Bluetooth DUN"
btPAN="Bluetooth PAN"
firewire="FireWire"
####################################################################################################
#define proxy servers
proxy="http://proxyconf.xxx.de:8/wpad.dat"
####################################################################################################
#detect network interfaces
usbAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: USB Ethernet"`
displayAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: Display Ethernet"`
tboltAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: Thunderbolt Ethernet"`
wiredAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: Ethernet"`
wifiAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: Wi-Fi"`
btDUNAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: Bluetooth DUN"`
btPANAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: Bluetooth PAN"`
firewireAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: FireWire"`
####################################################################################################
#######
#Create new Location "Company_NetWork" with Proxy, Bypass Domains and Search Domain
#######
networksetup -createlocation "Company_Network" populate
#Switch to Location Client_Net
networksetup -switchtolocation "Company_Network"
##############
## Ethernet ##
##############
if [ "$wiredAdapter" != "" ]; then
/usr/sbin/networksetup -setdhcp "$wired"
/usr/sbin/networksetup -setv6off "$wired"
/usr/sbin/networksetup -setproxybypassdomains "$wired" *.local 169.254/16 whatever.company.net
/usr/sbin/networksetup -setsearchdomains "$wired" dfl.local
fi
#####################
## Wifi ##
#####################
if [ "$displayAdapter" != "" ]; then
/usr/sbin/networksetup -setdhcp "$wireless"
/usr/sbin/networksetup -setv6off "$wireless"
/usr/sbin/networksetup -setproxybypassdomains "$wireless" *.local 169.254/16 whatever.company.net
/usr/sbin/networksetup -setsearchdomains "$wireless" dfl.local
fi
#########################
## Thunderbolt Adapter ##
#########################
if [ "$tboltAdapter" != "" ]; then
/usr/sbin/networksetup -setdhcp "$tbolt"
/usr/sbin/networksetup -setv6off "$tbolt"
/usr/sbin/networksetup -setproxybypassdomains "$tbolt" *.local 169.254/16 whatever.company.net
/usr/sbin/networksetup -setsearchdomains "$tbolt" dfl.local
fi
####################################################################################################
#######
#Create new Location "Home_Network" without any Settings
#######
networksetup -createlocation "Home_Network" populate
#Switch to Location Client_WIFI
networksetup -switchtolocation "Home_Network"
####################################################################################################
#Switch back to Location Client_Net
networksetup -switchtolocation "Company_Network"
exit 0
The Log:
Sending Wake On LAN command... Opening SSH Connection to 192.168.xx.xx.. Authenticating... Successfully authenticated. Verifying Computer's Identity... The MAC Address has been verified. Checking Operating System Version... Running Mac OS X 10.11.6 (15G31) Verifying /usr/local/jamf/bin/jamf... /usr/local/jamf/bin/jamf is current (9.99.0-t1494340586) Verifying /usr/sbin/jamf... /usr/sbin/jamf does not exist. Verifying /Library/Preferences/com.jamfsoftware.jamf.plist... Preparing Policy... Executing Policy 2017-06-21 at 10:15 AM | | 1 Computer Running script Network Location... Script exit code: 0 Script result: populated found it! ** Error: Unable to commit changes to network database. populated found it! found it! Submitting log to https://casper.xxx.local:8443/ Finished.
Thanks for help!
Chris