10.9.4 creating duplicate DFS Share mounts

New Contributor III

Hi there,

We are running a fleet of MBA's on 10.9.4 connected to Active Directory and mounting DFS Shares from a Windows 2012 R2 server. We use ControlPlane to, based on a network context, run a script to mount the network drives (will include the script below).

The issue is that when the Macs sleep or the screen is shut, after they are awakened, the drives are remounting and creating a few extra duplicates, eventually flooding the desktop throughout the day.

We assumed it was the script so we edited it as seen below, but the issue is persisting..

We have only seen this happen since the use of DFS shares was introduced instead of normal Windows shares. We have not verified this, but the issue does not seem to happen on Yosemite (NOT VERIFIED).

Any ideas? Thanks guys and gals.

property myDisks : {"Shared", "Media", "BOS_IB", "Emergency"}

set mountedDisks to paragraphs of (do shell script "/bin/ls /Volumes")
set username to system attribute "USER"
set urlToMount to "smb://host.local/DFS/Staff/Teachers/" & username

repeat with aDisk in myDisks

    if aDisk is not in mountedDisks then

        mount volume "smb://host.local/DFS/Staff/" & aDisk

    end if

end repeat

if username is not in mountedDisks then

    tell application "Finder"


            mount volume urlToMount

        end try

    end tell
end if

Honored Contributor III
Honored Contributor III

@mtaylor934, I have a similar script. But the mount commands are just:

mount volume <path to volume>

Perhaps try without the loops?

Link to what I do: https://macmule.com/2011/09/08/how-to-map-drives-printers-based-on-ad-group-membership-on-osx/