This Apple Script works great to mount the logged in Active Directory users network homedrive as a mounted network drive but we currently have it running as an App at login via "Login Items".

Instead I'd like to write this as a shell script so I can push it via Profile Manager as a login script since we are now succesfully running a few tasks off of a login script from PM.

Here is the AppleScript:

set username to do shell script "whoami"

set homepath to do shell script "dscl '/Active Directory/CAMPUS/All Domains/' -read /Users/" & username & " | grep SMBHome: | cut -c 10- | sed 's/\\\\/\\//g' "

tell application "Finder"

    try
        mount volume "SMB:" & homepath
    end try
end tell

Thank you for your help!

Below is a starting point.

username=`whoami`
homepath=`dscl '/Active Directory/CAMPUS/All Domains/' -read /Users/$username |grep SMBHome: | cut -c 10- | sed 's/\\\\/\\//g'`

mount_smbfs $homepath <mount_point>

I'm not really sure of the mount syntax. This answer may help with mount syntax.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.