Posted on 01-16-2017 09:18 AM
I have a simple SMB mapped drive script that points to a network folder.
# Mount the network home
mount_script=`/usr/bin/osascript > /dev/null << EOT
# tell application "Finder"
# activate
mount volume "smb://servername/folder/"
# end tell
EOT`
Under Shared (left side on Finder) it just says "servername", which when you have 2 shares with the same servername but different folder, they both do not show up.
So i would like to have 3 share names example:
Corporate Stuff (smb://servername/CorporateStuff)
My Home Drive (smb://servername2/$3)
Files (smb://servername/Files)
That way you can tell the difference between the shares in Finder.
Ideally if there was a way to add it to a users "Favorites" as well that would be helpful.
The script runs at Login and is Ongoing
Appreciate any help!
Posted on 01-16-2017 10:15 AM
Check out mysids: https://github.com/mosen/mysides/releases
It can get a little crazy when you have multiple sign-ins with Fast User Switching.
Posted on 01-23-2017 08:47 AM
Here is a bash script I built to go at the end of an Automator app we push out and add to the dock for users. Traditionally ours users would just re-run the automator app every time they need to reconnect their drives (like after connecting to VPN). This makes it so the users on newer OSes can just click on the favorites and it maps it on the fly for them without needing to re-run the automator app and re-mount.
I did some research and learned that you can use the somewhat undocumented 'sfltool' utility in El Capitan or newer to do this. Once you get the drives mapped somehow, you just need to make sure the volumes names match (file:///Volumes/$USER for instance). Anyways, feel free to use any part of it you'd like! I'm sure there is lots of room for improvement in it.
#!/bin/bash
#Exit if running Mavericks or Yosemite (won't have sfltool utility)
if [[ "$OSTYPE" = "darwin13" || "$OSTYPE" = "darwin12" ]]; then exit 0; fi
#Set expected user and Teams mount points
userpath="URL:file:///Volumes/$USER"
teamspath="URL:file:///Volumes/Teams"
#Build commands to add new favorites
addteams="/usr/bin/sfltool add-item -n "Teams" com.apple.LSSharedFileList.FavoriteItems "file:///Volumes/Teams""
addusers="/usr/bin/sfltool add-item -n "$USER" com.apple.LSSharedFileList.FavoriteItems "file:///Volumes/$USER""
#Set list of current favorites to $favorites
favorites=`/usr/bin/sfltool dump-storage ~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.FavoriteItems.sfl | awk '{print $NF}' | sort -u`
#Add favorite for Users if doesn't already exist
if [ `echo $favorites |grep -c $userpath` -eq "0" ]; then $addusers; fi
#Add favorite for Teams if doesn't already exist
if [ `echo $favorites |grep -c $teamspath` -eq "0" ]; then $addteams; fi
PS - to set the $USER variable I am using an apple script earlier in the automator app to do the following:
on run {input, parameters}
( Builds the path for network home directory )
set short_name to system attribute "USER"
set input to "smb://server.domain.com/Users/" & short_name
return input
end run