In a batch file, you use the %ERRORLEVEL% variable, or the IF ERRORLEVEL n command. For example:
psexec \\host -i findstr.exe "test" c:\testfile
if errorlevel 1 (
echo A problem occurred
)
IF ERRORLEVEL checks whether the return value is the same or higher than the number you specify.
This is not the same as capturing the output of the command though. If you actually want the output, you need to include redirection to an output file on the command line:
psexec \\host -i cmd.exe /c findstr "test" c:\testfile ^> c:\output.txt
The ^ is necessary to escape the > character, or the redirection would happen locally instead of on the remote machine. The cmd.exe is necessary, because redirection is handled by cmd.