Mount Drive Policy - How can i force it to run when it fails?

g1za
New Contributor III

Hi all,

I have a few policies that run when a user logs on to mount various shared drives that sit on the windows environment.

Sometimes these fail and flushing the policy sometimes doesn't work.

How would you suggest that i run the script to get the drives mounted? I have ARD available and of course Casper remote etc.

As its a school you can imagine users get stressed when these don't load and i could do with a way of running them quickly to alleviate that stress!

Thanks in anticipation.

5 REPLIES 5

apizz
Valued Contributor

@g1za How we have things setup (we're a school as well) is have a script which is based largely on the Amsys mounthome.sh script which we have wrapped up in an application. Although this script is meant for mounting home folders for Active Directory users, I think it could be a helpful model in your case. There's an app called Platypus (haven't used it myself) which is a GUI for taking scripts (bash, perl, AppleScript, Swift, etc.) and turning them into apps.

We have a LaunchAgent setup which automatically launches our mount drive app when users login. However, if it fails to mount, or users become disconnected, we've trained our users to simply click on the app in /Applications in order to mount their home folder.

Here's the LaunchAgent:

<?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.yourcompany.FolderMountLaunchAgent</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/your/app/executable</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

While you could use the JSS to deploy your app and the launchagent, I think not having your machines relying on a connection to the JSS in order to mount your desired drives would be advantageous.

Hope that's helpful.

apizz
Valued Contributor

The thought just came to me, but if the drives you want to mount are the same for a group of computers or users, you could create a Configuration Profile and with the Login Items payload set the drives you want to have mounted at login for those computers / users.

This would avoid having to be dependent on a policy in order to mount the drives, but if those drives didn't mount or users became disconnected there would be no mechanism for them to reconnect (unless they knew the Finder shortcut Command + K and network path of the drives they needed to mount).

g1za
New Contributor III

Thanks @aporlebeke Trying Platypus and look s good so far, managed to create an app that does the job.

Just need to decide how I want the app to work.

apizz
Valued Contributor

Yep, that's the tricky part @g1za!

Another script you might take a look at as another reference point is Macmule's Mount Network Drives AppleScript script.

Again, don't know if you use some directory service, but his AppleScript verifies some Active Directory group membership for the logged in user to discern which drives / folders should be mounted.

CasperSally
Valued Contributor II

We used to use JSS to run at login, but it was getting held up when machine was also installing patches from JSS. We went with the launch agent method similar to mentioned above to get the JSS out of the equation.

It's a shame the JSS doesn't give you away to prioritize login policies, that I could've said, this login script always runs first, then patches...