Hello, first off let me tell you what I am trying to accomplish.
We have around 50 Macs in our medical research labs that access a shared samba drive. The constant .ds_store placement bothers the windows users.
I know you can use the defaults utility to stop this (via apple’s site), but that only works for a single user profile. I need a solution that will work for any user that logs into the computer (anyone with an AD account can authenticate).
My solution was to create a log-in script that checks to see if the plist is in the ~/Library/Prefrences of the user before mounting the drive. If the file does not exist, it should copy the file, then restart the workstation.
I had this working fine in a bash script but the problem is I don’t know of a way to force a restart from the terminal without su access.
So I decided a applescript would be more fitting. The problem I run into is checking to see if the file exists in the users folder.
set posixPath to do shell script "cd ~/Library/Preferences; pwd"
set ASpath to POSIX file posixPath --converts UNIX-->applescript
set itExists to (exists the file "com.apple.desktopservices.plist" in path, ASpath)
if itExists = true then
tell application "Finder"
mount volume "smb://cancer1/shared$"
end tell
else
do shell script "cp -p " & "/com.apple.desktopservices.plist" & " " & "~/Library/Preferences/"
display dialog "Configuration complete" & return & "Computer must restart" & return & fileInfo buttons {"Restart"} default button 1
tell application "finder"
restart
end tell
end if
Thats what i got so far, but it fails on the exists statement, claiming “Can’t make file “com.apple.desktopservices.plist” of path into type reference.”
This is my first applescript I have written so ANY suggestions would be greatly appreciated
Thanks, I hope I have described my situation with enough detail. (also if any knows how to reach the end result, no .ds_stores on a network drive, some other way feel free to let me know)