Mounting shares with Login Items at login, Finder windows popup

Here are two very simple solutions made possible by automation tools baked right in Mac OS X, AppleScript and Automator.

AppleScript

You can use AppleScript to make a a very simple app that will mount your shares without opening any new Finder windows.

  1. Open AppleScript Editor and put in this script:

    tell application "Finder"
        mount volume "afp://Share.local/folder" as user name "username"
    end tell
    
  2. Adapt it to your need (configure your shares).

  3. Save it as an application.
  4. Add it to your login items in the "Accounts" preference pane.

It may ask your password the first time, but you can save it in Keychain and won't bother you anymore.

Of course, you can mount multiple disk by adding some additional mount volume lines.

Automator

If you prefer a visual interface, you can use Automator as well.

  1. Open Automator and choose "Application".
  2. Add action "Get Specified Servers" (in the "Files & folders" section).
  3. Add your shares in the list.
  4. Add action "Connect to Servers" (in the same section).
  5. Save the application.
  6. Add it to your login items in the "Accounts" preference pane.

Here's a screenshot of the process:

Automator Application Workflow


Have you tried instead configuring your mounts using Directory Utility. I just posted a quick how to get there here.

How can I stop OS X from automatically connecting to an NFS server on startup?

I authenticated as root, created a new empty record, dragged the share I wanted to mount silently to replace the dummy text of the new record and quit.

It figured out it was an afp share using mobile me to locate a remote mac. I certainly haven't tested this at all well in Lion - but this is the place I like to set up mounts rather than just popping them in the login items.

enter image description here

You might have to dig into the server documentation as setting up a directory (local or LDAP) can be a little tweaky and exact sequence and details count heavily whether it will work reliably.