Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Script to map Network shares

Hi,


We have several MAC desktops and laptops in our organisation. I am looking for a script for mapping drives based on users group membership. I have searched in internet and found below script to map network drives but how to get the logged in users group membership. Can someone please help me to create a script as I am very new to MAC.


  • tell application "Finder"
  • try
  • mount volume "smb://" & user_name & "@server/" & user_name & ""
  • end try
  • end tell

MacBook Pro, iOS 6.1.6

Posted on May 28, 2014 5:17 AM

Reply
Question marked as Best reply

Posted on May 28, 2014 5:23 PM

I'm going to assume you're referring to mounting the shares here, and not trying to map the network and to figure out which shares are present.


There are various ways to implement the mount; using login items is one possibility.


There are other approaches, such as configuring a profile for scripts that are run at login, too — if you have more than a few Mac systems around, then Apple would manage these via profiles or (maybe) via the older and increasingly-deprecated Open Directory MCX support.

3 replies
Question marked as Best reply

May 28, 2014 5:23 PM in response to SukhwinderSingh

I'm going to assume you're referring to mounting the shares here, and not trying to map the network and to figure out which shares are present.


There are various ways to implement the mount; using login items is one possibility.


There are other approaches, such as configuring a profile for scripts that are run at login, too — if you have more than a few Mac systems around, then Apple would manage these via profiles or (maybe) via the older and increasingly-deprecated Open Directory MCX support.

May 29, 2014 6:11 AM in response to SukhwinderSingh

First, have a look at your Group Policies or Mobile Device Management (MDM) tool, or whatever you're using in place of the Profile Manager tool that's incorporated into OS X Server. In particular, these details will determine what sort of scripts you can invoke on these Mac systems.


Most of these MDM tools will typically allow bash (or will allow invoking bash via AppleScript's do shell script mechanism), so Apple's Scripting Primer will get you started with bash command line scripting on OS X. This if you're interested in learning more about OS X and will be performing these login-related modifications yourself, and not via dragging the volume into the login payload or whatever your particular MDM supports. (Otherwise, you'll probably be outsourcing this work and/or hiring on a consultant — that'll probably be the fastest approach, if this is a quick one-off requirement, too.)


If you've decided to research and implement this yourself, you'll probably want to review the man mount_afp and man mount_smbfs man pages for details of the mount commands used at the command line, and for example commands. These two commands (combined with OS X or other keywords) can also provide you with Google or Bing search targets for existing examples posted around the forums and around the 'net.

Script to map Network shares

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.