AppleScript Passing Password to TMUTIL

Joined
Oct 24, 2016
Messages
2
Reaction score
0
I'm extremely new to AppleScript as in I only started playing with it last week. I wrote a script to mount a share and set up a time machine destination based on the user's name. This works fine unless the user's password has an @ sign in it. I was hoping that I could use tmutil setdestination -p so that it would prompt for the password but it won't do that if it's executed via applescript. So I was wondering how I can get the password into tmutil either by passing the password or getting the prompt visible from tmutil.

Below is a sample of my script:

This mounts the volume:
mount volume mvolafp as user name uname with password pword

This configures time machine only if the user's password does not contain an @ sign:
do shell script "tmutil setdestination \"afp://" & uname & ":" & pword & "@" & mvol & "\"" with administrator privileges

I'm even starting to think of crazy ideas like having applescript create a shell script with the tmutil command and then have it execute that script.

Any ideas? It may seem easier to teach the users how to set up time machine but that would be the very last resort. Thank you.
 

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
11,106
Reaction score
497
Hello and welcome.

Most of us here don't have much experience with AppleScript/Automator either. There is a good forum that has knowledgeable folks over at MacScripter. Maybe they can shed some light.

C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top