Created
February 25, 2019 08:18
-
-
Save MelvinStans/812d419bd30e0c0e703d599fcf525c2e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
########################################################################################## | |
# Create time date stamped log | |
########################################################################################## | |
logFile="/private/var/log/OurCompany.log" | |
log () { | |
/bin/echo $1 | |
/bin/echo $(date "+%Y-%m-%d %H:%M:%S: ") $1 >> $logFile | |
} | |
log "-----" | |
log "Begin script resetMacNetwork.sh" | |
log "Adjust Network Locations to correctly add network ports" | |
sleep 5 | |
########################################################################################## | |
# Create a temporarily Network location and recreate the Automatic location. | |
########################################################################################## | |
networksetup -createlocation TempLoc populate | |
sleep 5 | |
networksetup -switchtolocation TempLoc | |
sleep 2 | |
networksetup -deletelocation Automatic | |
sleep 2 | |
networksetup -createlocation Automatic populate | |
sleep 5 | |
networksetup -switchtolocation Automatic | |
sleep 5 | |
networksetup -deletelocation TempLoc | |
log “Network Location Setup Completed.” | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment