New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

Applescript Q: Can you use applescipt to give mounted network volumes unique names


Post Reply New Thread Subscribe

 
Thread Tools
dcrutch

 
Member Since: Jun 23, 2011
Posts: 2
dcrutch is on a distinguished road

dcrutch is offline
Hi all,

Through some digging (google) and trial and error, I have pieced together the following script that does what I want it to do.
1) It asks the user for their username and password
2) It authenticates that info with our domain
3) It maps 4 windows network shares (DFS shares) for the user

So my only problem now is that when the 4 drives map, 3 of them map with the same name because three of the paths that are mapped end in folders named after the username. Because of DFS and user rights, I can’t map them a folder level higher, the path must end with their username folder.

Thus I end up with 1 department drive and 3 username drive icons on the desktop, whereas I want to end up with 4 uniquely named drive icons on the desktop, to reduce end user confusion (work, department, posting, receiving).

Assumptions:
I would like this script to work for remote users who aren’t joined to AD, so they would VPN connect to us, then run the script to map the drives. Again, this works now, just have the naming issue.
I don’t want to join the macs to the domain.
I want to avoid alias’ if possible.
I want to do this in a single script.

So I’d like to find a way to modify this existing script to rename mounted volumes to names that I choose. Right now the network icon on the desktop is named for the last folder in the path.

Once you “mount volume” is there a way within applescript to then rename that mounted volume so the 4 icons that show up on the user’s desktop each have a unique name?

to getusername()

display dialog "Enter your username:" default answer ""

set username to text returned of result

return {username}

end getusername

to getuserpwd()

display dialog "Enter your password:" default answer "" with hidden answer

set userpwd to text returned of result

return {userpwd}

end getuserpwd

set userID to getusername()

set userpass to getuserpwd()

set Domain to "mydomain"

# Map their Work drive

tell application "Finder"

try
mount volume "smb://" & Domain & ";" & userID & ":" & userpass & "@server/work/" & userID
end try

end tell

# Map their Department drive

tell application "Finder"

try
mount volume "smb://" & Domain & ";" & userID & ":" & userpass & "@server/department/"
end try

end tell

# Map their Posting drive

tell application "Finder"

try
mount volume "smb://" & Domain & ";" & userID & ":" & userpass & "@server/posting/" & userID
end try

end tell

# Map their Receiving drive

tell application "Finder"

try
mount volume "smb://" & Domain & ";" & userID & ":" & userpass & "@server/receiving/" & userID
end try

end tell
QUOTE Thanks
dcrutch

 
Member Since: Jun 23, 2011
Posts: 2
dcrutch is on a distinguished road

dcrutch is offline
Update: Looks like Lion may support DFS mappings (hoping it releases this month), so I'm going to wait to see how that works with WGM (workgroup manager) and I'll join them to AD if needed.

While my script is still useful for mapping drives, it's not ideal for mass enterprise deployment and I'd still have my original problem of several mapped volumes with the same name.
QUOTE Thanks

Post Reply New Thread Subscribe


« Do i have a virus? | Terminal command gone wrong »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
mDNSResponder/ network traffic reduction measures in effect Head_Unit OS X - Operating System 0 03-01-2011 11:23 PM
AppleScript Question - NetAuthAgent and mounting volumes automatically at login applewax OS X - Operating System 0 04-21-2008 02:12 PM
Changed Account names not reflected throughout network nworbmit Switcher Hangout 1 01-04-2008 08:11 AM
Applescript to login to school network? mkko OS X - Operating System 0 10-07-2004 07:38 AM

All times are GMT -4. The time now is 09:42 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?