Not able to get Jamf to mount shared drives

New Contributor II

Hi all, I am new to Casper and also to Mac scripting. I just want to mount as simple as possible our shared drives to the users Macs. I got an osascript running which works perfectly on the Mac itself.
Have imported it to Casper Admin, created a policy but it doesn't work. It states me an error:

Script exit code: 127 Script result: /Library/Application Support/JAMF/tmp/MountSharedDrives: line 2: tell: command not found /Library/Application Support/JAMF/tmp/MountSharedDrives: line 3: try: command not found mount: You must specify a filesystem type with -t.

Find below the osascript I wrote:

set userName to do shell script "whoami"
tell application "Finder"
        mount volume "cifs://"
        mount volume "cifs://"
        mount volume "cifs://" & userName & "/"
    end try
end tell

Honored Contributor II

@bmgsupport you need to wrap that AppleScript in Bash to run in Jamf Pro. I use the script that @davidacland posted in this discussion:

User Shared Drive Script

I specifically use this script to provide different "Mount" buttons in Self Service for my users.

New Contributor II

@stevewood thanks for your swift reply.
It worked just once but now I always get the error like below:

Script exit code: 1 Script result: 36:44: execution error: Finder got an error: Application isn’t running. (-600)

Do you happen to know why?

Honored Contributor II

@bmgsupport sorry, I am not familiar with that particular error. When you say that it worked once, do you mean that you were able to run the script one time and then the second time it did not work? Or that you ran the script once, it mounted the first share and then errored out?

Valued Contributor

We use a slightly modified version of this and it works extremely well.

Might be worth looking into?

New Contributor II

@mark.mahabir How do you use this script? Via a policy which autmatically maps the drives triggered by login or recurring checkin?
And you also need to wrap it right?

I need to clear up: The script mention by @stevewood works via SelfService, but not triggered by login or recurring checkin.
Its weird. I'll do some further investigating.