It could be down to server updates. If the smb share is on a Windows Server, older smb protocols like smb 1 have been deprecated due to no enryption. I had issues with smb print shares and had to switch to lpd. I don't use smb drive shares anymore, so not seen this issue myself.
For good measure i always use the following when the script needs to be run in the user context or reflect data related to the user. I've had issues with $3 parameter in the past and using the following has never failed me.
currentUser=$(stat -f "%Su" /dev/console)
Cheers!
Thanks @mrheathjones -- forgive my naivety; would this be the correct update to the script?
username="$(stat -f"%Su" /dev/console)"
# Mount the drive
mount_script=`/usr/bin/osascript > /dev/null << EOT
delay 10
tell application "Finder"
mount volume "smb://[serverip]/[Drive]/$username/Documents"
end tell
EOT`
exit 0
It could be down to server updates. If the smb share is on a Windows Server, older smb protocols like smb 1 have been deprecated due to no enryption. I had issues with smb print shares and had to switch to lpd. I don't use smb drive shares anymore, so not seen this issue myself.
thanks - hoping that isn't the culprit, although we did just run into that same SMB error with SMB print shares and had to update to lpd in that scenario.
Thanks @mrheathjones -- forgive my naivety; would this be the correct update to the script?
username="$(stat -f"%Su" /dev/console)"
# Mount the drive
mount_script=`/usr/bin/osascript > /dev/null << EOT
delay 10
tell application "Finder"
mount volume "smb://[serverip]/[Drive]/$username/Documents"
end tell
EOT`
exit 0
@echalupka Our HomeDrive is named My Documents below is a sanitized version of my script. Hope this helps.
#! /bin/sh
current_User=$(/usr/bin/stat -f%Su /dev/console)
homeDrive_Path="smb://[server]/[PERSONAL_SHARE]/$current_User/My Documents"
homeDrive_Name="My Documents"
sudo -u "${current_User}" osascript <<EOT
on listMountedDisks()
list disks
end listMountedDisks
if (listMountedDisks() does not contain "${homeDrive_Name}") then
mount volume "${homeDrive_Path}"
end if
EOT
@echalupka Our HomeDrive is named My Documents below is a sanitized version of my script. Hope this helps.
#! /bin/sh
current_User=$(/usr/bin/stat -f%Su /dev/console)
homeDrive_Path="smb://[server]/[PERSONAL_SHARE]/$current_User/My Documents"
homeDrive_Name="My Documents"
sudo -u "${current_User}" osascript <<EOT
on listMountedDisks()
list disks
end listMountedDisks
if (listMountedDisks() does not contain "${homeDrive_Name}") then
mount volume "${homeDrive_Path}"
end if
EOT
Thanks @mrheathjones -- Updated with the info you provided and we're back up and running!
Eric