Originally published on 2017-11-28
Small Applescript snippet for Mounting Network share drive on a Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set MyShare to "MyShare" | |
set OpenShare to "OpenShare" | |
tell application "System Events" to set diskNames to name of every disk | |
set myDisks to {MyShare, OpenShare} | |
repeat with myVolume in myDisks | |
try | |
if myVolume is in diskNames then | |
tell application "Finder" to eject disk myVolume | |
end if | |
moutVolume(myVolume) | |
delay 1 | |
end try | |
end repeat | |
-- have it as a subroutine for future re-use | |
on moutVolume(myVolume) | |
mount volume "smb://networkspace2.local/" & myVolume as user name "adminnnn" with password "blahblah" | |
end moutVolume |