Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 4, 2008, 09:12 PM   #1
drummer21scum
macrumors newbie
 
Join Date: Feb 2008
Mount smb shares on login

Hi total newbie to mac os x, work in a server 2003 environment, starting to introduce mac's at work, using leopard...

i was just wondering if anyone knows the script to mount a windows share eg.
\\mySrver\myShare$ and then add it to the finder sidebar...

just sick to death of going to finder>connect to server etc

any help would be great
drummer21scum is offline   0 Reply With Quote
Old Feb 5, 2008, 12:13 AM   #2
larkost
macrumors 6502a
 
Join Date: Oct 2007
There are a few different routes to go:

If you are in an "enterprise" setting, then there is a good chance that there is an Active Directory server in the mix, and you can then bind to the AD server, and your "home" folder can be auto-mounted at login. You just need to use the directory utility for that.

Another option is to make an alias of the folder (inside the share) that you want. Unlike Windows shortcuts, aliases can contain the data needed to get to the share.

Another option is to make the alias, then put it in your login items.

After that there are a whole number of other ways (mount_smbfs on the command line, MCX if you are really good, etc), but I think you should probably chose one of the first three.
larkost is offline   0 Reply With Quote
Old Feb 5, 2008, 09:29 AM   #3
jeremy.king
macrumors 603
 
jeremy.king's Avatar
 
Join Date: Jul 2002
Location: Fox Lake, IL
I use an Applescript application. Only because I didn't want to explain to the wife how to execute a shell script. A simple alias on the desktop, a double click, and Bam!

Code:
tell application "Finder"
	mount volume "afp://username:password@hostname/sharename"
end tell
if you want SMB, simply change the afp to smb.

Last edited by jeremy.king; Feb 11, 2008 at 09:14 PM. Reason: better way to do this.
jeremy.king is offline   0 Reply With Quote
Old Feb 6, 2008, 03:40 AM   #4
drummer21scum
Thread Starter
macrumors newbie
 
Join Date: Feb 2008
worked at treat! thanks, not to be a bit greedy but you wouldnt know how to add the share to the finder sidebar after it opens, would you? cos for some reason in leopard when u connect to a share its not mounted on the desktop or finder for some reason? strange
drummer21scum is offline   0 Reply With Quote
Old Feb 6, 2008, 10:21 AM   #5
jeremy.king
macrumors 603
 
jeremy.king's Avatar
 
Join Date: Jul 2002
Location: Fox Lake, IL
You can show volumes on the desktop by going to Finder Preferences and under the General Tab click the Connected Servers check box. To add the volume to the devices list, you can drag the now visible drive from the finder desktop into the list of devices in a finder window, and everytime you reconnect it should show up in the list.
jeremy.king is offline   0 Reply With Quote
Old Feb 8, 2008, 04:44 AM   #6
satyam90
macrumors regular
 
Join Date: Jul 2007
Location: Bangalore, India
Send a message via Yahoo to satyam90
Quote:
Originally Posted by kingjr3 View Post

Code:
tell application "Finder"
	open location "afp://username:password@hostname/sharename"
end tell
Will the above script work only for windows 2003 server? What script I have to use if I want to connect to Windows XP or Linux/Unix machine?
satyam90 is offline   0 Reply With Quote
Old Feb 8, 2008, 05:12 AM   #7
itsallinurhead
macrumors 6502
 
Join Date: Apr 2007
Location: Southern California
Send a message via AIM to itsallinurhead
Quote:
Originally Posted by satyam90 View Post
Will the above script work only for windows 2003 server? What script I have to use if I want to connect to Windows XP or Linux/Unix machine?
I thought you wanted to use "smb://...." if you were connecting to a windows shared drive?
itsallinurhead is offline   0 Reply With Quote
Old Feb 9, 2008, 04:35 AM   #8
satyam90
macrumors regular
 
Join Date: Jul 2007
Location: Bangalore, India
Send a message via Yahoo to satyam90
How about connecting to Linux/Unix systems???
satyam90 is offline   0 Reply With Quote
Old Feb 9, 2008, 04:16 PM   #9
jeremy.king
macrumors 603
 
jeremy.king's Avatar
 
Join Date: Jul 2002
Location: Fox Lake, IL
Quote:
Originally Posted by satyam90 View Post
How about connecting to Linux/Unix systems???
The protocol is determined by how you are sharing. Are you using Samba? NFS? Apple File Sharing?
jeremy.king is offline   0 Reply With Quote
Old Feb 10, 2008, 12:09 AM   #10
tjwett
macrumors 68000
 
tjwett's Avatar
 
Join Date: May 2002
Location: Brooklyn, NYC
you can also just add the volumes to the Login Items in the Accounts pane of System Preferences. if the authentication to the share is stored in the keychain it will automount.
__________________
"The spice must flow..."
tjwett is offline   0 Reply With Quote
Old Feb 10, 2008, 12:16 AM   #11
aLoC
macrumors 6502a
 
Join Date: Nov 2006
Quote:
Originally Posted by tjwett View Post
you can also just add the volumes to the Login Items in the Accounts pane of System Preferences. if the authentication to the share is stored in the keychain it will automount.
Yes, that is the easiest way, just one drag and drop operation.

Open System Preferences, click on Accounts, click the Login Items tab, and drag and drop the disk icon from your desktop to the login items.
aLoC is offline   0 Reply With Quote
Old Feb 11, 2008, 12:55 PM   #12
jeremy.king
macrumors 603
 
jeremy.king's Avatar
 
Join Date: Jul 2002
Location: Fox Lake, IL
Quote:
Originally Posted by aLoC View Post
Yes, that is the easiest way, just one drag and drop operation.

Open System Preferences, click on Accounts, click the Login Items tab, and drag and drop the disk icon from your desktop to the login items.
But what do you do if the drive isn't available or disconnects?
jeremy.king is offline   0 Reply With Quote
Old Feb 11, 2008, 08:54 PM   #13
brguitarist
macrumors member
 
Join Date: May 2007
Location: New Jersey
thanks for the useful thread...
simple question though, both through applescript and login items, when the drives mount, a finder window pops up with that drive selected.
since i'd be mounting 3 drives i was wondering if you guys know how to keep those windows from popping up
__________________
Mid 2012 11" MBA (2GHz/8GB/256GB), iPhone 5S (16GB)

brguitarist is offline   0 Reply With Quote
Old Feb 11, 2008, 09:09 PM   #14
hmmfe
macrumors regular
 
Join Date: Feb 2003
Quote:
Originally Posted by brguitarist View Post
thanks for the useful thread...
simple question though, both through applescript and login items, when the drives mount, a finder window pops up with that drive selected.
since i'd be mounting 3 drives i was wondering if you guys know how to keep those windows from popping up
I use an automator script and the share is mounted but a finder window does not open. Would think I'd behave just like applescript...? Oh well, automator works well for me.
hmmfe is offline   0 Reply With Quote
Old Feb 11, 2008, 09:14 PM   #15
jeremy.king
macrumors 603
 
jeremy.king's Avatar
 
Join Date: Jul 2002
Location: Fox Lake, IL
Quote:
Originally Posted by brguitarist View Post
thanks for the useful thread...
simple question though, both through applescript and login items, when the drives mount, a finder window pops up with that drive selected.
since i'd be mounting 3 drives i was wondering if you guys know how to keep those windows from popping up
Code:
tell application "Finder"
	mount volume "afp://user:pass@server/sharename"
end tell
This seems to not pop up the window and probably a better way to mount the share.
jeremy.king is offline   0 Reply With Quote
Old Feb 11, 2008, 09:27 PM   #16
brguitarist
macrumors member
 
Join Date: May 2007
Location: New Jersey
Cool, thanks kingjr3
__________________
Mid 2012 11" MBA (2GHz/8GB/256GB), iPhone 5S (16GB)

brguitarist is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Timeout before disconnecting SMB shares HackerJL Mac OS X Server, Xserve, and Networking 6 Jul 25, 2013 02:35 PM
SMB Shares Broken 618537 OS X 10.8 Mountain Lion 14 Feb 11, 2013 11:16 AM
Color Labels and SMB Shares HughMad Mac OS X 10.7 Lion 0 Jan 8, 2013 06:37 PM
Searching SMB shares on ML.. Anyone got a it working? chandler99 OS X 10.8 Mountain Lion 5 Jul 30, 2012 07:24 PM
SMB Shares Omnikurt OS X 10.8 Mountain Lion 3 Jul 26, 2012 01:01 PM

Forum Jump

All times are GMT -5. The time now is 02:24 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC