Issues with MountNetworkShare.sh

sfurois
New Contributor II

Hello,
I'm trying to use the mountnetworkshare.sh script to map several network locations for my userbase. When I place the correct variables, the script seems to parse them correctly, but then I get a large amount of 'No such file or directory' errors. This happens both with DFS and SMB shares (I don't have any AFP shares I'm aware of). I have this set as a login trigger, and the script says it completes 'successfully'.

Output is as follows:

For SMB

Script result: Volume name will be created as (Folder2)...
Attempting to mount smb SMB://(Domain/ShareFolder1/ShareFolder2) using (user)'s kerberos ticket...
su: /usr/bin/sh: No such file or directory
su: /usr/bin/sh: No such file or directory
su: /usr/bin/sh: No such file or directory
su: /usr/bin/sh: No such file or directory
Loading com.jamfsoftware.mapdrive.(Folder2)...
su: /usr/bin/sh: No such file or directory

For DFS:

Script result: Volume name will be created as Folder2...
Attempting to mount DFS DomainFolder1Folder2 using (user)'s kerberos ticket...
su: /usr/bin/sh: No such file or directory
su: /usr/bin/sh: No such file or directory
su: /usr/bin/sh: No such file or directory
su: /usr/bin/sh: No such file or directory
Loading com.jamfsoftware.mapdrive.(Folder2)...
su: /usr/bin/sh: No such file or directory

I have the correct parameters set ($5, $7, $8) and I am not using hardcoded values but I'm not sure why this error is occurring. It is having the problem on a 10.12.6 machine.

4 REPLIES 4

mm2270
Legendary Contributor III

That's an ancient script that hasn't been updated since 2010, 8 years ago.

For starters, the method of getting the OS version is old and ran into problems starting with 10.10, where it would only get "10.1" no matter what OS it was on, thinking the OS version was below 10.6. It runs a different set of commands in that case, and probably not one that's going to work with a Mac running Sierra.

If you locate this line in the script:

OS=`/usr/bin/defaults read /System/Library/CoreServices/SystemVersion ProductVersion | awk '{print substr($1,1,4)}'`

and change it to:

OS=$(sw_vers -productVersion | cut -d. -f1,2)

It might then work, but I haven't tried it so I don't know for sure.

sfurois
New Contributor II

Thanks for the feedback. I'll look for something more recent to work off of.

retroroscoe
Contributor

Hi,

have a look at NoMAD, works a treat for mapping network shares, both mac and windows servers

mark_mahabir
Valued Contributor

Also have a look at this script, which works really well for us.