Teamcity interaction with powershell script


I have a powershell script that runs for ~30 minutes (waiting on various process’ to finish). At the end, it writes a message to the event log, determining if the process was a success or failure. I plan on hosting this script on teamcity and want the build to fail, but don’t know how to handle the interaction between the script and teamcity in order for this to happen.

I’m looking for a way to make a powershell script that is ran remotely to communicate to teamcity whether it was a failure or success. I’ve read up on a lot of the teamcity documentation and I’m still not sure how to start going about this.


You should probably consider using TeamCity Service Messages, or specifically Reporting Build Problems.

An example of how to emit a service message using PowerShell (assuming you’re using the PowerShell build step):


where you can inject the captured powershell error message.


Teamcity interaction with powershell script by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply