SMB Share Drive

georgel
New Contributor III

I have tried using the script below but i keep getting error on the macs ive pushed the policy to

URLs with the type ":" are not supported

The policy logs show this error:

Executing Policy Jupiter Running script Jupiter Mount... Script exit code: 0 Script result: Protocol: serverName: -jupiter shareName: 48:75: execution error: Finder got an error: An error of type -5014 has occurred. (-5014) Relaunching dock(s)...
#!/bin/sh

protocol="$smb" # This is the protocol to connect with (afp | smb)
    echo "Protocol: $smb"
serverName="$bc-jupiter"   # This is the address of the server, e.g. my.fileserver.com
    echo "serverName: $bc-jupiter"
shareName="$media"    # This is the name of the share to mount
    echo "shareName: $media"

# Mount the drive 
    mount_script=`/usr/bin/osascript  > /dev/null << EOT
    tell application "Finder" 
    activate
    mount volume "$protocol://${serverName}/${shareName}"
    end tell
EOT`

exit 0

Someone please help!

1 ACCEPTED SOLUTION

justin_smith
New Contributor III

@georgel

give this a try.

#!/bin/sh

protocol="smb" # This is the protocol to connect with (afp | smb)
    echo "Protocol: $protocol"
serverName="bc-jupiter"   # This is the address of the server, e.g. my.fileserver.com
    echo "serverName: $servername"
shareName="media"    # This is the name of the share to mount
    echo "shareName: $sharename"

# Mount the drive 
    mount_script="$(/usr/bin/osascript << EOT
    tell application "Finder" 
    activate
    mount volume "${protocol}://${serverName}/${shareName}"
    end tell
EOT)"

exit 0

View solution in original post

3 REPLIES 3

justin_smith
New Contributor III

It's a bit late, and holiday over here, but it looks like you're trying to call a variable "$smb" that isn't being defined in your script? try removing the "$"

rderewianko
Valued Contributor II

dang @justinssmith i was just going to post that!

justin_smith
New Contributor III

@georgel

give this a try.

#!/bin/sh

protocol="smb" # This is the protocol to connect with (afp | smb)
    echo "Protocol: $protocol"
serverName="bc-jupiter"   # This is the address of the server, e.g. my.fileserver.com
    echo "serverName: $servername"
shareName="media"    # This is the name of the share to mount
    echo "shareName: $sharename"

# Mount the drive 
    mount_script="$(/usr/bin/osascript << EOT
    tell application "Finder" 
    activate
    mount volume "${protocol}://${serverName}/${shareName}"
    end tell
EOT)"

exit 0