[Help] Auto Mount Network Drives At Login

apanages
New Contributor

Hello,

I have been trying for some time to configure a script that will mount network drives for a user when they log into their Mac. I have been all over JamfNation and have read many of other users posts to try to get this to work in my environment. I have successfully created an AppleScript when launched manually on the Mac will auto mount network drives but I am having issues making this automated and being able to push this to multiple devices.

I learned really quick that when you push scripts and packages through Casper, Casper will run them as root and I need this to run as the user for this to work. I have attempted to try LaunchAgents but for what ever reason that is not working for me as well. If someone could point out what I am doing wrong, that would be very helpful and appreciated.

Process:
1. Created a LaunchAgent called com.networkdrives.startup.plist in /Library/LaunchAgents

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.networkdrives.startup</string>
    <key>Program</key>
    <string>/Casper/MapNetworkDriveScript.sh</string>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
  1. The LaunchAgent points to a script called MapNetworkDriveScript.sh located in /Casper
open /Casper/NetworkDrivesTS.app --args -AppCommandLineArg
  1. The script launches NetworkDrivesTS.app located in the same folder /Casper when should mount the network drives.

*When I manually launch NetworkDrivesTS.app the network drives mount.

Any suggestions?

Thank-you,

-Anthony

2 REPLIES 2

PatrickD
Contributor II

Hi @apanages

Are your user accounts network accounts or local accounts?

I would suggest trying a Config Profile with a Login Items payload and add the network drive path names that you wish to mount on login. This should do it for you. If not you could always use the same Config Profile and just add the aforementioned .app as a login item.

Cheers,
Pat

bentoms
Release Candidate Programs Tester

@apanages you need to specify the applet executable.

As per my example here.