Handling exceptions when executing commands on remote console