I have a post-build script (powershell) which throws an exception, as expected. The post-build script is defined in the build definition in the 'Post-build script path' section. The exception is logged in the 'Other Errors and Warnings' section of the build.
With gated check-in turned on changes are still committed even though the build is classed as 'partial' (because the post build script failed).
It seems that commits are only rejected if MSBuild fails or the unit tests fail.
How can I reject any commits on a partial build result?
You can modify the build template to implement a different logic, if you don't like it: see How to change Partially Succeeded build to Succeeded in TFS 2010.