Mapping Network Drives with Jamf Pro

Hi, thanks for taking the time to watch this video about mapping network drives with Jamf Pro. As you may have seen from some of our blogs, config profiles are the standard way to map network drives with Jamf Pro, but unfortunately they have a few issues, so at Amsys, we use a bash script triggered by a login policy instead.

In this quick video we’ll show you how to add the script to Jamf Pro and configure it for use in a policy.

First off, lets log in to Jamf Pro, head over to computers > management settings >   scripts.  You can download the script from our github repo > public scripts and shareconnect.

There’s two versions of the script on this page:  

  1. shareConnect is general purpose and can be used directly on macOS systems, triggered by something like outset or a launchagent.  
  2.  shareconnect_casper is a specialised version designed specifically for use with a Jamf Pro system.  There are two main differences.  The first is in the variables passed to the script.  

In the generic version, we’re passing $1, $2, $3 & $4 to the script.  In Jamf Pro, 1, 2 & 3 are reserved for other purposes so we start at $4.  Secondly, the shareconnect_casper script leaves out the group variable, as the Jamf system already has the ability to limit by group membership.

And so to continue

We’ll select the Casper script and copy it’s contents.  Back in the Jamf Pro server, we’ll create a new script and give it a name.  Next we’ll paste the contents of the script into the web page.  The script is kept generic with variables that are passed to it from the policy, so there is no need to edit the contents.

As an optional extra, we can set parameter labels.  This isn’t required, but will make it easier to add the script to a policy.

Parameters are strings that are passed to the script and can be called by the script using $1 for the first string, $2 for the second and so on.

In the case of a Jamf Pro script that gets used in a policy, by default the script parameters just show up as parameter 4, parameter 5 etc.  If we edit the script options we can give more friendly labels to each of the parameters and they will show up when you are creating the policy.

So next lets add the labels.  

Parameter 4 is the protocol, either afp or smb.  5 is the server name, either as the IP or FQDN and lastly parameter 6 is the share name, which is case sensitive.

The final step is to use the script in a policy.  

Click on computers, policies and add a new policy.  As this is mapping a drive, we will use the login trigger and set it as ongoing, so it runs each time the user logs in to their computer.  Next we’ll add the script.  As you can see, the parameter labels are pulled through, making it a bit easier to set the right values.  We’ll enter the protocol, servername and sharename, which just leaves us to set the scope.”


David Acland

I have been with Amsys since the summer of 2000 working as a hardware technician. In 2002 I started delivering technical training courses, including the full range of Apple hardware and software courses. In 2009 I started a new division at Amsys delivering technical projects and providing support for business and education clients. Over the years I've enjoyed contributing to technical f... more

Featured Podcasts

Mapping Network Drives with Jamf Pro
Jamf Pro podcast - March 11, 2017

Kerberos 1.01
networking podcast - April 28, 2017