Make sure that the batch file is exiting with a non-zero exit code when the PowerShell script fails, and use the Batch File action in Visual Build to call it, or include the call statement (i.e., %DOSCMD% call batchfile.bat) when running the batch file if calling directly (otherwise the exit code may not be returned to Visual Build).
http://www.microsoft.com/resources/d....mspx?mfr=true
https://stackoverflow.com/questions/...ering-an-error
https://stackoverflow.com/questions/...ograms#4825773
http://www.kinook.com/Forum/showthread.php?t=260