I want to run a command/script (test.sh) on remote machines and also want to store the (std output and std error) in a file in my local machine.

but

In all the remote machines thats command/script (test.sh) is not available. so I want to store that Hostname of of that machine with the error message in a file on my local machine.

is it possible ???

thanks