Deployment Agents

Hi all,
  We've been using Teamcity as our CI for a couple of weeks and we absolutely love it.  We have a bit of a scenario that I can't seem to address, and some help would be greatly appreciated.

From my understanding Teamcity is set up in an Agent/Server architecture.  As such we can run builds on any agents.  Our systems, test, stage, and production all have a well defined deployment process, and I would like to create an agent that only performs deployments.  Here's how I envision the process.

1. Install deployment agents on all our servers, test, stage and production
2. After a build is successfull, a user in the proper group (configured via Teamcity) can log into Team city and deploy the build to any environment they choose
3. The Deployment agent is notified the build is ready, and it downloads the artifact and executes the custom deployment.

I realize that deployments are very application specific, and therefore Jetbrains cannot produce a standard deployment agent.  I've read the doc on downloading artifacts via HTTP interface of the build server, but this still requires a developer to log in to our systems to deploy.  I'd like to initiate deployment via the Teamcity web interface independently of the build process.  Is there a way I can do this with custom plugins?



May be this blog post can help you:
In brief you can install agent on the same PC where a server which needs to be redeployed is installed. If agent is on the same PC the deployment process can be greatly simplified. This agent can execute special build script which not only will obtain and prepare artifacts but also will redeploy your application in the server.


Hi Pavel,
  This has been a great help, but I'm still a bit stuck.  Here's what I've done with the build agent.

  1. Install it on the server
  2. Set a dependency to be our main build.  I extract the pattern Release*/*.zip!** to C:\releases.  This works as expected
  3. Once the unzip has been performed, we normally log in via Remote desktop, then fire up a command line.  From there, I do a C:\DeploymentScripts then execute the command

    C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe . 'C:\DeploymentScripts\deploy-test.ps1'

I've set my working directory to be


and the command to execute to be

C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe . 'C:\DeploymentScripts\deploy-test.ps1'

However I receive this error every time.

Cannot run process: CreateProcess: "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe . 'C:\DeploymentScripts\deploy-test.ps1'" error=123

[17:58:12]: com.intellij.execution.process.ProcessNotCreatedException: CreateProcess: "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe . 'C:\DeploymentScripts\deploy-test.ps1'" error=123
com.intellij.execution.process.ProcessNotCreatedException: CreateProcess: "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe . 'C:\DeploymentScripts\deploy-test.ps1'" error=123
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(
at jetbrains.buildServer.agent.runner2.GenericCommandLineBuildProcess.createProcess(
at jetbrains.buildServer.agent.runner2.GenericCommandLineBuildProcess.start(
at jetbrains.buildServer.agent.impl.runStages.CallRunnerStage.doBuildStage(
at jetbrains.buildServer.agent.impl.BuildRunAction.doStages(
at jetbrains.buildServer.agent.impl.BuildRunAction.access$000(
at jetbrains.buildServer.agent.impl.BuildRunAction$
Caused by: CreateProcess: "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe . 'C:\DeploymentScripts\deploy-test.ps1'" error=123
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(
at java.lang.ProcessImpl.start(
at java.lang.ProcessBuilder.start(
at java.lang.Runtime.exec(
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(
... 7 more

[17:58:18]: Build finished

Any ideas?

Please check user under which your build agent service is working. This user may not have enough permissions to run powershell.

Also check out this bug report for possible problems with powershell:


Hi Pavel,
  I gave up on the powershell, I'm wrapping a cmd file with an MSBuild file.  Basically I only have one task, here's my file.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DeployBuild" xmlns="">

  <Target Name="DeployBuild">
    <Exec Command="deploy-test.cmd" />


When I run my msbuild it correctly deploys.  I've set my build file path to be C:\DeploymentScripts\deploybuild.proj and my working directory to be C:\DeploymentScripts.  However I always get the error below.

Cannot find build file by path specified in build configuration settings: 'C:\DeploymentScripts\deploybuild.proj' (absolute path on agent)

I'm running my build agent under the SYSTEM account, and I've double checked that the SYSTEM account has full CRUD permissions recursively set.  Any ideas what's going on?  I can't seem to find the cause of the error in any of the agent logs.


Please try to use usual user account instead of SYSTEM, or try to start agent from the agent.bat script.


So, I'm incredibly embarassed to admit that after I changed to the MSBuild config, the problems were all between my keyboard and chair.  My builds were running on my teamcity agent, not my test server agent.  I know I can go into each agent and specifically select with builds they can run.  However, I'd like to leave everything default so that new projects are distributed normally across all agents, and only force my deployment build to run on the Test Agent.  Is there a way to do this without modifying each agent individually?


You can specify that deployment configuration can run on Test Agent only. You need to change one agent settings only.


Thanks, for the help.  I was able to come up with the following in the deployment agent on my test server.


and for any development builds I have


This allows me to require the correct values in my build and deployment runtimes, and appropriate agents are automatically selected.  Thanks for all the guidance!


I meant you can explicitly select which configurations can be built on an agent. See tab Compatible agents for the agent itself, there you can change "run selected configurations only" and mark checkboxes near the desired configurations.


Please sign in to leave a comment.