execute 'do shell script' on remote machine?

Is there a way to do this? For instance, if I need to attempt to restart the AppleFileServer on the remote end if I can’t mount an AFP volume?

Yes it is possible:

do shell script “ssh @ \‘sudo serveradmin stop afp; sudo serveradmin start afp\’”

The only downfall is that you have to enter 2 times the passwords. Once to make a SSH connection, and the second time to do the sudo.

I’m currently looking to find a way to get that password into the Apple Script and send it’s output directly in the script.

Want to be able to let a poweruser to just push a button and the voila the AFP service is restarted.

Does someone know how?