• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Trying to write a logon script that accesses an SMB share
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to write a logon script that accesses an SMB share


  • Subject: Trying to write a logon script that accesses an SMB share
  • From: Mike Soultanian <email@hidden>
  • Date: Thu, 09 Oct 2008 19:33:20 -0700

Hi Everyone,
I'd like to write script that first mounts a drive to a permanent share location (i.e. smb://fileserver/macscripts). In this location will be a text file that contains a single line of text (the path for all of the user's files - i.e. fileserver/dancedept/dance office). The script will then read that text file, unmount the first drive, and then mount a new drive using the location specified in the text file (i.e. smb://fileserver/dancedept/dance office). This way, if the folder structure ever changes, all I need to do is update the text file in the central share location and voila, all the users will automatically get the new drive.


If this seems convoluted, it's probably because it is. I am a Windows system administrator and I am trying to come up with something similar to centrally-located Windows logon scripts and I figured that this was a creative way to script all of our Macs such that upon login they will have their drives automatically mounted for them. The key thing is that I want to be able to change the path from a central location should it ever change. If anyone has a better solution, *please* let me know. If not, well, then I guess it's scripting time!

I've done some digging and here's what I've figured out how to do...

Mount a drive:

try
tell application "Finder"
mount volume "smb://fileserver/sharefolder" as user name "USERNAME" with password "PASSWORD"
end tell
end try



I've also figured out how to read in a text file:

on readFile( unixPath )
  set foo to (open for access (POSIX file unixPath ))
  set txt to (read foo for (get eof foo))
  close access foo
  return txt
end readFile


...Now I was hoping someone on this list could help me with the next step. I'm really good at other scripting languages but unfortunately AppleScript syntax is foreign to me so I'd appreciate any help!!


Thanks,
Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Prev by Date: Re: AppleScript broken in 10.5.4
  • Next by Date: Detecting Applescript and SKYPE
  • Previous by thread: Re: Make an internet location file with AppleScript?
  • Next by thread: Detecting Applescript and SKYPE
  • Index(es):
    • Date
    • Thread