rename network drive

Abdelhafid
New Contributor

Hi everyone,

We have a windows file cluster on which we share files through DFS. I use login script to map 4 shares on our OSX machines. This works fine however the names of the shares are all the same (dfs structure names the different shares based on the customer). Changing the share names unfortunatly
isn't an option. On the windows machines this isn't a problem since the shares are assigned different driveletters to differentiate them.

I've tried using a applescript

mount volume "smb://domain.tld/dfs/service/customer"

and a shell script with the mount_smbfs command

#!/bin/sh

mkdir -p /Volumes/CustomerShareName; mount_smbfs 'smb://domain.tld/dfs/service/customer'  '/Volumes/CustomerShareName'

However the mounted volumes show up in the finder with the original sharename and can't be renamed.

After some researching it seems the only way to achieve what I want is to mount the shares and create an alias so I can display them with the name I want.

I was wondering if anyone has found a way to set a custom name for mounted network shares without using aliases.

Thanks.

2 ACCEPTED SOLUTIONS

davidacland
Honored Contributor II
Honored Contributor II

I haven't come across any way to do this unfortunately. In the past we have either created aliases as you mentioned, or colour labelled the mounted volumes. Colour labelling has been less effective recently as the labels are so much more subtle in recent OSes.

View solution in original post

davidacland
Honored Contributor II
Honored Contributor II

The times I've had to do this it has been in a school so the goal was to make it as simple as possible for the students. In these scenarios I mounted the share via a script and used

ln -s

to put a link on the desktop of the current user.

We switched off the finder preference to show network drives on the desktop and deleted the links at logout to make sure they were always correct.

The simpler route could be to add a link to the volume on the desktop once and let the user mount it when they need to.

View solution in original post

5 REPLIES 5

davidacland
Honored Contributor II
Honored Contributor II

I haven't come across any way to do this unfortunately. In the past we have either created aliases as you mentioned, or colour labelled the mounted volumes. Colour labelling has been less effective recently as the labels are so much more subtle in recent OSes.

Abdelhafid
New Contributor

Thanks for your anwser. I guess Aliases it is then. When using aliases did you link them to the network shares with mounting them as network volumes first? Or did you create an alias for the mounted network volumes.

Im wondering which is best.

davidacland
Honored Contributor II
Honored Contributor II

The times I've had to do this it has been in a school so the goal was to make it as simple as possible for the students. In these scenarios I mounted the share via a script and used

ln -s

to put a link on the desktop of the current user.

We switched off the finder preference to show network drives on the desktop and deleted the links at logout to make sure they were always correct.

The simpler route could be to add a link to the volume on the desktop once and let the user mount it when they need to.

Abdelhafid
New Contributor

Thanks for the info. Time to get scripting :).

spotter
New Contributor III

I have created a utility which is available to the users in Self Service. The approach i took was to add in (which firsts hides "Connected Servers" via Finder)

tell application "Finder"
    tell Finder preferences
        set desktop shows connected servers to false
    end tell
end tell

Then here is the script which maps the drive and creates/rename the alias

if OUmembership contains "Information_Services" then
                activate
                display dialog "Is the network path listed below correct? If so please click Create Mapping or otherwise correct the network path and then click Create Mapping" default answer "//domain.com/dfs/share" buttons {"Create Mapping", "Exit"} with title "Network Share Mapping Assistant" with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:GenericFileServerIcon.icns"
                if button returned of the result is "Create Mapping" then
                    set folderPath to text returned of result
                    set folderLetter to driveLetter
                    set folderName to folderLetter & " Drive"
                    try
                        tell application "Finder"
                            set folderName to mount volume "smb:" & folderPath
                            set aliasFolder to make new alias file at desktop to folderName
                            set the name of aliasFolder to folderLetter & " Drive"
                        end tell
                    end try
                end if

Just to let you know this probably isn't the best way however its works really well for our users...