Has anyone had issues using PsExec with TeamCity?

I have a build configuration that needs to execute a program on another box as one of the steps in the process. I am using PsExec to execute that process and when I paste the EXE and appropriate arguments in a console window it works fine. When I attempt to have a BuildAgent run PsExec, i get nothing.

My configuration is:

  • Box A - TeamCity Web site and a build agent

  • Box B - a build agent

  • Box C - a build agent

  • Box D - nothing

  • Box E - nothing

Box C executes the build configuration and needs to run a batch file on Box D. I use a command line Runner with the settings below:


Working directory: C:\admin\pstools

Command executable: C:\admin\pstools\psexec.exe

Command parameters: -accepteula "
BoxD" -u "DOMAIN\USER" -p "password" -n 60 -w "C:\Program Files\Vendor\Sites\Item\PipelineComponents" "C:\Program Files\Vendor\Sites\Item\PipelineComponents\RegisterAll_Debug.bat" /np

My build log always looks like this:

: Checking for changes
: Clearing temporary directory: C:\BuildAgent\temp\buildTmp
: Checkout directory: C:\BuildAgent\work\2992cb09c8021ada
: Getting project sources
: Loading changed files from server...
: Updating C:\BuildAgent\work\2992cb09c8021ada
: Starting build process in C:\Admin\Pstools
: C:\admin\pstools\psexec.exe -accepteula "
BoxD" -u "DOMAIN\USER" -p "password" -n 60 -w "C:\Program Files\Vendor\Sites\Item\PipelineComponents" "C:\Program Files\Vendor\Sites\Item\PipelineComponents\RegisterAll_Debug.bat" /np
: PsExec v1.94 - Execute processes remotely
: Copyright (C) 2001-2008 Mark Russinovich
: Sysinternals - www.sysinternals.com
: Process exit code: -1
: Build cancelled

The job should take about 45 seconds to run and DOES take that long when I open a command window on BoxC complete with output to the console.


Help is appreciated...


This looks like some psexec.exe issue.
You might find this useful: http://forum.sysinternals.com/forum_posts.asp?TID=5013

It seems you can workaround the issue by adding ">nul" to the end of the command line parameters (this will also cause output to be unavailable).


I would think it was a PsExec issue as well, but the fact that I can execute the commands in a console window without issue led me to think otherwise.

Am I missing something?


I attempted the ">nul" and still had the same issue.

Edited by: amidavew on Sep 2, 2008 5:12 PM


Sorry for the long delay. The question is still relevant? If yes please leave a comment or create a separate thread.

Kind regards,

Did you all ever find a solution or work around for PSexec in TeamCity using Nant Build Runer? The command hangs in TeamCity but works great via command line. Let me know if there are any TC version fixes that address this.


<exec program="${dir}\psexec" commandline='\\${webserver} msiexec /x {${product.id}} /q' failonerror="false" />


Please sign in to leave a comment.