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"

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

Thank you for your help!

1 Answer 1


Below is a starting point.

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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .