Posted on
12-10-2018
02:22 PM
- last edited
a month ago
by
kh-richa_mig
We changed the network share to a different name and the Mac and still trying to connect to the old share path. Can't figure out why. We are also leveraging Enterprise Connect in our environment as well. I have already checked Login Items in System Preferences and nothing is listed there. Below is the script
userName=$(stat -f %Su /dev/console)
if [[ "$userName" != "root" ]] && [[ "$userName" != "" ]]; then shareURL="smb://corpfs01/Public"
existingURL="$(sudo -u $userName -H defaults read com.apple.Enterprise-Connect shares | grep "$shareURL")"
if [[ "$existingURL" == "" ]] ; then # Quit Enterprise Connect sudo -u $userName -H killall "Enterprise Connect" sleep 2
# Add network drive mapping sudo -u $userName -H defaults write com.apple.Enterprise-Connect shares -array-add "{ "path" = "$shareURL"; }"
# Restart Enterprise Connect
sudo -u $userName -H open "/Applications/Enterprise Connect.app"
fi
fi
exit 0