[MacTUG] Mapping a Network Drive at Login

Donald Duff-McCracken dsmccrac at uwaterloo.ca
Fri Mar 2 15:45:22 EST 2012


Thanks Guillermo

I like that one that gets the N drive from nexus, that is pretty cool.
Hopefully as students migrate to the 'fileu' server (hopefully aliased as
something that does not sound so rude) that will be less needed, but
really neat nonetheless.

Currently I have my golden-triangle mounting their n-drive (with Active
Directory saying where it is and what the credentials need to be and Open
Directory telling the lab mac that it should do this), but I do have an
emergency backup script to remount the drive, and it looks a lot like your
'hardwired' script:

tell application "Finder"
	activate
	set UserName to (do shell script "whoami")
	try
		mount volume "smb://" & UserName & "@envfile.uwaterloo.ca/Accounts"
	end try
	try
		if not (item ("Accounts-" & UserName) of the desktop exists) then make
new alias file to folder UserName of disk "Accounts" at desktop with
properties {name:"Accounts-" & UserName}
	on error
		display dialog "I cannot find your user directory on the Accounts Server
or you typed the incorrect password"
	end try
end tell

One of thing I added as getting it to make an alias of the user's account
on the desktop so that it is easier for theme to save stuff to it.


Don



------------------------------------
Donald Duff-McCracken
Technical Services Manager
Mapping, Analysis & Design
Faculty of Environment
University of Waterloo
(519) 888-4567 x32151
http://www.environment.uwaterloo.ca/computing/people/don.html
------------
To request help from MAD please us Request Tracker. For info see:
http://www.environment.uwaterloo.ca/computing/faculty_staff/
<http://www.fes.uwaterloo.ca/computing/faculty_staff/>
------------
This email communication is intended as a private communication for the
sole use of the primary addressee and those individuals listed for copies
in the original message. The information contained in this email is
private and confidential and If you are not an intended recipient you are
hereby notified that copying, forwarding or other dissemination or
distribution of this communication by any means is prohibited.  If you are
not specifically authorized to receive this email and if you believe that
you received it in error please notify the original sender immediately.







On 12-03-01 9:51 PM, "Guillermo Fuentes" <gfuentes at uwaterloo.ca> wrote:

>
>Hi Lowell,
>In Arts we place a script called "Connect to my Nexus N drive" on the
>Desktop for users to mount their Nexus drive. The script also enables the
>"shows connected servers" on the Finder.
>
>I'm including the code for two Apple scripts, the first one has the file
>server hardcoded (artsfile.uwaterloo.ca) for Arts students. The second
>one reads the home directory from Nexus.
>
>It works fine on Snow Leopard. I haven't try this on Lion.
>
>Guillermo
>
>
>(*********** 1st script: hardcoded file server ************)
>(*
> Connects to Nexus N drive prompting for the user's password.
>*)
>
>tell application "Finder"
>	try
>		set username to do shell script "whoami"
>		tell application "Finder" to mount volume "smb://" & username &
>"@artsfile.uwaterloo.ca/" & username
>	on error errtext number errnum
>		if errnum = -55 then
>			display dialog "Your Nexus N drive is already mounted"
>		else
>			display dialog "Coudn't connect to your Nexus N drive"
>		end if
>	end try
>	open window of Finder preferences
>	set current panel of window of Finder preferences to General Preferences
>panel
>	set desktop shows connected servers of Finder preferences to true
>	close window of Finder preferences
>end tell
>(*********** end hardcoded file server ************)
>
>
>(***********  2nd script: file server from Nexus home directory
>************)
>(*
> Connects to Nexus N drive prompting for the user's password.
>*)
>tell application "Finder"
>    try
>        set username to do shell script "whoami"
>        set homedirectory to do shell script "ldapsearch -LLL -H
>ldap://ursa.nexus.uwaterloo.ca -b 'dc=nexus,dc=uwaterloo,dc=ca'
>'(&(objectClass=user)(sAMAccountName=" & username & "))' homeDirectory |
>grep 'homeDirectory:'|awk -F' ' '{print $2}' | sed -e 's/\\\\/\\//g'"
>        
>        tell application "Finder" to mount volume "smb:" & homedirectory
>    on error errtext number errnum
>        if errnum = -55 then
>            display dialog "Your Nexus N drive is already mounted"
>        else
>            display dialog "Coudn't connect to your Nexus N drive"
>        end if
>    end try
>    open window of Finder preferences
>    set current panel of window of Finder preferences to General
>Preferences panel
>    set desktop shows connected servers of Finder preferences to true
>    close window of Finder preferences
>end tell
>
>(*********** end file server from Nexus home directory ************)
>
>
>
>From: mactug-bounces at lists.uwaterloo.ca
>[mactug-bounces at lists.uwaterloo.ca] on behalf of Donald Duff-McCracken
>[dsmccrac at uwaterloo.ca]
>
>Sent: Thursday, March 01, 2012 11:59 AM
>
>To: Lowell Williamson; MacTUG
>
>Subject: Re: [MacTUG] Mapping a Network Drive at Login
>
>
>
>
>
>
>
>
>
>
>
>
>
>Hi Lowell
>
>
>
>
>
>I usually get the user to connect to the server manually (under the Go
>menu) and get them to click 'remember password in keychain' or however it
>is worded. Then your solution should work.
>
>
>
>
>
>So if I would want it to autologon, I would do these steps:
>
>as the apple article states, it is probably a good idea to have the
>connected servers show up on the desktop (so people do not get confused)
>so I would click that on in Finder preferencesMount the network share
>using Go>Connect to ServerClick the remember password in keychain
>buttonGo to System Preferences>User & Groups>username>login itemsAt this
>point I probably would not drag the whole share into the window. I would
>open the share (called 'Users' in this case) and then find the username I
>wanted and drag it into the window as described in the apple doc you
>linked to.I wish the 'hide' button would not cause the window to open all
>the time on login, but maybe that is what you want.
>
>An alternative if you have people that do not want it always auto logging
>in is that you could drag the users folder on the share down onto the
>dock ‹ it has to be on the 'folder' side of the dock (to the right of the
>little dotted line). That way when
> they want to connect the user name and password that is saved in the
>keychain is used to mount the connection.
>
>
>
>
>
>It is probably better that a user is set to auto login and it probably is
>good that it pops into their face every time they log in. It is probably
>not a bad idea however to make an alias of their account on the share and
>put it on the desktop. It is an
> easier way for them to navigate to their directory than scrolling
>through all the users on the network share.
>
>
>
>
>
>don
>
>
>
>
>
>
>
>
>
>
>
>------------------------------------
>
>Donald Duff-McCracken
>
>Technical Services Manager
>
>Mapping, Analysis & Design
>
>Faculty of Environment
>
>University of Waterloo
>
>(519) 888-4567 x32151
>
>http://www.environment.uwaterloo.ca/computing/people/don.html
>
>------------
>
>To request help from MAD please us Request Tracker. For info see:
>http://www.environment.uwaterloo.ca/computing/faculty_staff/
>
>------------
>
>This email communication is intended as a private communication for the
>sole use of the primary addressee and those individuals listed for copies
>in the original message. The information contained in this email
> is private and confidential and If you are not an intended recipient you
>are hereby notified that copying, forwarding or other dissemination or
>distribution of this communication by any means is prohibited.  If you
>are not specifically authorized to receive
> this email and if you believe that you received it in error please
>notify the original sender immediately.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>From: Lowell Williamson <llwillia at uwaterloo.ca>
>
>Date: Thu, 1 Mar 2012 16:35:21 +0000
>
>To: MacTUG <mactug at mailman.uwaterloo.ca>
>
>Subject: [MacTUG] Mapping a Network Drive at Login
>
>
>
>
>
>
>
>
><!--
>@font-face
>	{font-family:Calibri}
>p.MsoNormal, li.MsoNormal, div.MsoNormal
>	{margin:0cm;
>	margin-bottom:.0001pt;
>	font-size:11.0pt;
>	font-family:"Calibri","sans-serif"}
>a:link, span.MsoHyperlink
>	{color:blue;
>	text-decoration:underline}
>a:visited, span.MsoHyperlinkFollowed
>	{color:purple;
>	text-decoration:underline}
>span.EmailStyle17
>	{font-family:"Arial","sans-serif";
>	color:#595959}
>@page WordSection1
>	{margin:72.0pt 72.0pt 72.0pt 72.0pt}
>-->
>
>
>
>
>
>Hi,
> 
>I¹m trying to have our standalone MAC users map their N: drive
>automatically at login. The path to N: is
>smb://fileu.uwaterloo.ca/users$/%username%. I¹ve tried adding it to the
>Login Items as per,
>
>http://support.apple.com/kb/HT4011, but it won¹t pass the username and
>password. I¹ve also tried it using the mount command but with no luck.
>
> 
>Does anyone have a fix for this?
> 
>Thanks.
>--
>Lowell
>_________
> 
>______________________________
>Lowell L. Williamson
>AHS IT Specialist
>University of Waterloo
>BMH 2111 ext. 32326
>______________________________
>Check out the
>
>AHS Computing Facebook Page
> 
>
>
>
>_______________________________________________ MacTUG mailing list
>MacTUG at lists.uwaterloo.cahttps://lists.uwaterloo.ca/mailman/listinfo/mactu
>g
>
>
>
>
>_______________________________________________
>MacTUG mailing list
>MacTUG at lists.uwaterloo.ca
>https://lists.uwaterloo.ca/mailman/listinfo/mactug




More information about the MacTUG mailing list