Not able to get Jamf to mount shared drives

bmgsupport
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"
    try
        mount volume "cifs://our.domain.com/abc/share/"
        mount volume "cifs://our.domain.com/abc/music/"
        mount volume "cifs://our.domain.com/abc/home/gt_home/" & userName & "/"
    end try
end tell
5 REPLIES 5

stevewood
Honored Contributor II
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.

bmgsupport
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?

stevewood
Honored Contributor II
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?

mark_mahabir
Valued Contributor

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

Might be worth looking into?

bmgsupport
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.

Thanks
Thomas