I use this to unmount the server at home which by the way is a windows server so you will have to replace the “smb” with the apple “afp”. I have also submited a mount server script which has the title “Mount server over wireless connection” so you can do a search for that one if ya want. that is also for a windows server.
OS version: OS X
tell application "Finder"
try
eject "yourVolumenameHere"
--say "Server Unmounted"
on error number errNum from badOBj
set dialogResult to display dialog "Volume "yourVolumenameHere" not mounted do you want to mount VOLUME" buttons {"YES", "NO"} default button 2 with icon 0
if button returned of dialogResult = "NO" then
error number -128 --user cancelled
else
if button returned of dialogResult is "YES" then
set ping_result to (do shell script "ping -c 1 xxx.xxx.x.x")
if "100% packet loss" is in ping_result then
display dialog "Server Not On!!!" buttons "OK" default button 1 with icon 0
else
if "0% packet loss" is in ping_result then
mount volume "smb://userName:password@xxx.xxx.x.x/yourVolumeNameHere"
display dialog "Server has been mounted" buttons "OK Then!" default button 1 with icon 2 giving up after 10
end if
end if
end if
end if
end try
end tell