Network Share

wblack
New Contributor II

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

!/bin/bash

userName=$(stat -f %Su /dev/console)

This should never be run at the login window, but checking just in case.

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

0 REPLIES 0