Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

NS-RED

macrumors newbie
Original poster
Nov 14, 2014
1
0
Hi
we are trying to automatically map network drives for our users, the share folder is the same name as the username.

In the past we were using the below script which has worked, but now we have upgraded our OS to Yosemite the script is no longer working properly.


#!/bin/sh
/usr/bin/osascript > /dev/null << EOF
set myname to do shell script "whoami"

tell application "Finder"
try
do shell script "umount -a -f -t smbfs"
end try

try
do shell script "rm -f ~/Desktop/Idrive"
do shell script "rm -f ~/Desktop/public$"
end try

try
mount volume "smb://" & myname & "@fs1/" & myname
do shell script "ln -s /Volumes/" & myname & " ~/Desktop/IDrive"
end try

try
mount volume "smb://fs1/public$"
do shell script "ln -s /Volumes/public$ ~/Desktop"
end try
end tell


EOF

Thanks for any help much appreciated.
 

kryten2

macrumors 65816
Mar 17, 2012
1,114
99
Belgium
The mount volume and do shell script commands are part of StandardAdditions. Remove the tell "Finder" block, it's not needed.
Unexpected errors can occur when those commands are used in a tell application "Application" block.
Wrapping statements in try statements without an error handler isn't really helpful in debugging the script if any of those statements causes an error as all errors will be ignored.
 
Last edited:

kladda

macrumors newbie
Sep 25, 2011
27
0
there is some apps for that if you are in no mood to work on that script...

Just search for Network drives on mac app store.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.