Mac Bootup - Mapping/Mounting to Windows Shares Automatically
I'm currently using Mac OS x 10.5 and originally had these scripts while using 10.4 (thus I haven't tested them on any earlier versions).
Normally when you want to map (mount) to a Windows shared network drive you have to click on the word "Go" in the finder menu, choose "Connect to Server..." (propeller-K), and use SMB to mount to a Windows shared server.
Example:
However, I have several shares I use on my network (a NAS that uses SMB) and I prefer to have my shares connect automatically on startup. So I use the following script to map to my drives (using Apple's Script Editor).
2 set ping_result to (do shell script "ping -c 1 -t 2 -i 2 192.168.1.10")
3 mount volume "smb://workgroup;userName@192.168.1.10/shareName"
4end try
From there I can either add all the drive mappings I want to that one script, or save them as individual scripts (the way I usually do it). Then I save the script as an application (make sure to uncheck "Startup Screen", unless you want that extra step).
Finally I add the applications to my startup (System Preferences --> Accounts --> Highlight the account --> Login Items (tab) --> Then I add the applications to the list.
On some occasions (for some reason), when my machine starts up not all of the mappings will connect (giving an error that the destination was unreachable). I haven't figured out why yet, but it only happens occasionally, so I've been living with it (to fix it I just manually click the application again and I'm in).
There are plenty of other methods to get this to work, but I haven't had much luck with others yet (I'm still a bit new to Mac and *nix). If someone else out there has a great idea (or a better one), feel free to let me know.