Mount networkdrive "silently"

Discussion in 'Mac OS X Server, Xserve, and Networking' started by tjep, Dec 18, 2009.

  1. tjep macrumors newbie

    Joined:
    Dec 18, 2009
    #1
    Hi there
    I am not able to get a proper fix to this problem after having searched high and low... so can you help me?

    I have a NAS drive that I would like my Mac to connect to upon boot... I know that I can point to the share under login items, but I don't want to open the share in a finder window... just to have it connect automatically without Finder.... can I do this??
     
  2. Hoodman macrumors newbie

    Joined:
    Feb 20, 2009
    Location:
    Mexico
    #2
    Hi. you could use automator... i don't remember the exact instructions. but i have the program in my other mac at home. I can look for the exact program. but if you want to try, i remember that there are 2 instructions. first to look for the server, and then to connect, or obtain the volume. then you make the executable and add it to to the login itlem.

    the other way is making a shellscript, and add that script to the loginHook. it is not that difficult to do that.
     
  3. tjep thread starter macrumors newbie

    Joined:
    Dec 18, 2009
    #3
    With automator - will I not see the Finder window?... If so - I would really love your help in setting it up when you get back to your own machine..
     
  4. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #4
    Of course, you can do this with Applescript as well.



    Code:
    property mapdrive1 :[B]"afp://server.local/share"[/B]
    mount volume mapdrive1
    
    All you need to do is modify the bolded portion to fit your needs. You can easily add other drives by adding another property. Like this:

    Code:
    property mapdrive2 : "afp://server.local/anothershare"
    

    Then add another mount volume line. All you need to do then is save the script and as it to your login items.

    If you have credentials saved for the server, or are using Kerberos you will not get a password prompt. If not, you should consider saving the credentials to your keychain.
     
  5. Hoodman macrumors newbie

    Joined:
    Feb 20, 2009
    Location:
    Mexico
    #5
    yes, no finder window

    ok, i was playing around with your problem because i was tired at my work and remembered how the program is done!

    First with applescript:

    Code:
    tell application "Finder" to open location "afp://$username@$server/$volume"
    it will mount but... the finder window will appear, so i went to automator.

    You have to make an application, and put at the workflow:

    "Get Specified Servers". Here you can choose to put manually the NAS address like:

    if is an apple share (Time Capsule, Mac)
    Code:
    afp://your.server:port/Volume
    if is windows based
    Code:
    smb://your.server:port/Volume
    if it is something else (I think your NAS will use this...)
    Code:
    nfs://your.server:port/Volume
    or simply use the add button and hope your mac detects the NAS

    then drop at the workflow "connect to servers"

    then press the play button and see if it works. I've already tried it on a server here at my work, and its good. But remember that if you have a password for the NAS remember to add it to the keychain.

    Another thing to notice, if you have multiple Volumes at the NAS after the port value you have to add "/YourVOLUME" so a window asking to select the volume you want wont appear.

    Any problems, just ask! :cool:
     
  6. tjep thread starter macrumors newbie

    Joined:
    Dec 18, 2009
    #6
    You GUYS ROCK!!!
    Thanks a lot... I will try this when I get a chance over the weekend...

    One questions to the automator-bit... "create an application"... A hint on how to do this? And will it then be this application that I will be adding to my login items?
     
  7. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #7
    Well of course a Finder window appears, you are telling the application "Finder" to do something.

    That is why you simply use the mount volume functions which does not cause a Finder windows to appear.

    I am wary of Automator because actions like to break for no reason. Very rarely does an applescript simply break if you are calling apple functions like "mount volume."
     
  8. tjep thread starter macrumors newbie

    Joined:
    Dec 18, 2009
    #8
    Small update

    Just wanted to say that I went with Calderon'es suggestion... clean, simple and it works.... thank you both very much....:):apple::D
     

Share This Page