Re: mount volume command
Re: mount volume command
- Subject: Re: mount volume command
- From: "John C. Welch" <email@hidden>
- Date: Tue, 01 Oct 2002 07:45:04 -0400
On 10/01/2002 03:45, "Brian Ling" <email@hidden> wrote:
>
Is there a way of including the nt/win2000 domain when
>
using the mount volume command, to mount an smb
>
volume. I know how to
>
>
tell application "Finder"
>
mount volume
>
"smb://username:password@serverdnsname/share
>
end tell
>
>
How can I change this to include the domain name? or
>
is there another way to achieve the same result.
The easiest way I have found is to put the mount information in the
keychain, then use keychain scripting to extract the needed information for
mount volume. That way, you can deal with the domain info too. I.e.
set theLoggedInUserID to do shell script "/usr/bin/whoami"
tell application "Keychain Scripting"
set theKeychain to keychain thLoggedInUserID
set theKey to internet key foo
set theServer to server of theKey
set thePath to path of theKey
set thePassword to password of theKey
set theKeyUser to the account of theKey
set theDomain to the security domain of theKe
set theProtocol to theProtocol of theKey as text
if theProtocol contains "smb" then
set theProtocol to "smb"
end if
set theMountURL to theProtocol & "://" & theServer & "/" and thePath
mount volume theMountURL as user name theKeyUser with password
thePassword
end tell
I've found the domain takes care of itself once you've set the keychain
entries correctly. Since 'smb' isn't a pre-set protocol in keychain
scripting, you have to pull it from the constant returned for the protocol
in those cases, hence the if statement.
But it does save you from having to enter passwords in 'display dialog' or
embedding them in the script. I use a variation of this for auto mounting
various drives at work.
john
--
"If you're not gonna pull the trigger, don't point the gun."
- James Baker
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.