Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Using Applescript to mount SMB shares' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Using Applescript to mount SMB shares
Authored by: dwarne on Jun 11, '02 10:27:12AM

Applescript can also be used to very easily mount SMB shares. You can either put the applescript icon on your desktop for double-click access, or you can put it in your login items.

The exact applescript is as follows (simple!)

tell application "Finder"
open location "smb://user:password@computername/sharename"
end tell

For example...

tell application "Finder"
open location "smb://administrator:danwarne@mailserver/c"
end tell

[ Reply to This | # ]

Using Applescript to mount SMB shares
Authored by: zedwards on Jun 11, '02 04:06:47PM

So simple, so obvious, yet so overlooked. This tip deserves to be on the main page.



[ Reply to This | # ]
Using Applescript to mount SMB shares
Authored by: unxmaal on Jun 11, '02 04:42:28PM

Ouch! Schooled by both dwarne and monkeyvoodoo on the same tip!

Thanks though. This applescript rocks!



[ Reply to This | # ]
Using Applescript to mount SMB shares
Authored by: SamW on Oct 18, '02 10:25:24AM

I have used the above and it works wonderful. how ever since i have upgraded a computer to 10.2 it seems not to work. I get the following error: "Finder got an error: an error type of -10814 has occurred" The exact script is as follows:

tell application "Finder"
open location "smb://henry/student"
end tell

I thought I was alone until some students have also reported the same error on their 10.2 systems.

Any help would be appreciated.

Sam



[ Reply to This | # ]
Using Applescript to mount SMB shares
Authored by: russh on Oct 29, '02 10:25:03PM

I think that things changed in Applescript 1.9. This format works for me in 10.2.1:

try
mount "smb://myname:passwd@server.domain.com/sharename"
end try

Hope that helps.



[ Reply to This | # ]
? Disconnect/Umount SMB shares using Applescript in 10.2/Jag ?
Authored by: bartelsrausch on Jan 17, '03 02:35:46AM

How would I dissconnect shares using Applescript? I connected them using the applescript command to /Volumes/<sharename>.
thanks for any help, thorsten



[ Reply to This | # ]
? Disconnect/Umount SMB shares using Applescript in 10.2/Jag ?
Authored by: serversurfer on Sep 13, '03 09:56:05AM
Try this:

tell application "Finder"
    eject (every disk whose name is "sharename")
end tell


---
Love,
The Surfer

[ Reply to This | # ]

Using Applescript to mount SMB shares
Authored by: limulus on Oct 06, '03 12:41:37AM

The correct syntax is "mount volume".

I found this useful to create a Favorite for a WebDAV volume hosted on a nonstandard port.



[ Reply to This | # ]
Using Applescript to mount SMB shares
Authored by: hartmurmur on Jan 21, '04 04:37:26PM
Is the process any different when you need to log in to a machine on a differnt domain that what you are in? I need to connect to a machine across domains and to the root. The following does not work for me.

try
mount volume "smb://domain\\userid:password@ipaddress/drive$"
end try


[ Reply to This | # ]
Using Applescript to mount SMB shares
Authored by: hartmurmur on Jan 21, '04 04:50:11PM
Nevermind. Found the answer in a different thread...

try
mount volume "smb://workgroup;userid:password@ipaddress/drive$"
end try
and also referenced at developer.apple.com: Using SMB on OS X

[ Reply to This | # ]
Using Applescript to mount SMB shares
Authored by: JoePrecious on Nov 20, '03 02:21:15PM

This is exactly what I need and works great.

Just one question (from an AppleScript newbie):-

Can you tell it not to actually open the Finder window as it now does it everytime I log in?

Thanks



[ Reply to This | # ]
Solution: No Finder Window
Authored by: forman on Jan 11, '04 09:12:17PM
Use the following Applescript to mount smb drives in the background without opening Finder windows. The mount point is automatically created in the /Volumes directory.
try
   mount volume "smb://user@server/share"
end try
For a user with a login name of "forman" on a server called "vortex" with SMB shares called "local" and "scratch" use the following script:
try
   mount volume "smb://forman@vortex/local"
   mount volume "smb://forman@vortex/scratch"
end try
Save the script as an application using the Script Editor and put it in System Preferences -> Accounts -> Startup Items to mount the drives when you log in.

Michael.

[ Reply to This | # ]