error with automator applescript "do shell script" call (file not found) yet command line with same command works
I haven't tested this, but it looks like you have too many levels of quotes there. You manually put double-quotes around the command to be run over ssh (in the set fn to "\"/usr/bin/open ... &amp; "\"" line), and then use quoted form of fn, which adds another level of quotes. It looks fine when you echo it, but that's because the shell parses &amp; removes one level of quotes before passing to the echo command.

Also, if the file path contains spaces or other funny characters, those need to be quoted (but only that path part, not the entire command). Try this instead:

on run {input, parameters}
    repeat with fn in input
        set fn to POSIX path of fn
        set fn to "/Volumes/MachineA" &amp; fn
        set fn to "/usr/bin/open -a /Applications/Preview.app " &amp; quoted form of fn
        set cmd to "ssh -x MachineB.local " &amp; quoted form of fn
        do shell script "echo " &amp; quoted form of cmd &amp; " &gt;&gt; ~/cmd.log"
        do shell script cmd
    end repeat
end run