How to get multiple TeamCity build agents running on one server.
First log in to the server where you want the agents to run then open TeamCity from a browser on that box.
Go to the Agents tab.
From the top right of the page choose Install Build Agents then MS Windows Installer.
When prompted choose to run the agent installer. You may have to be an administrator since this will be installing windows services.
Choose the directory where you want the agent configuration and working directories to live. I put them under the TeamCity home directory.
Take the defaults as you work your way through the installer.
The agent directory is being configured.
Here it is important that you choose a unique name and port. The directories should be consistent with your previous choices. You may need to change the server URL and port.
When this popup appears do not click OK yet.
Open an Explorer window and navigate the the launcher/conf directory under the build agent directory you configured above.
Edit wrapper.conf and change the name of the ntservice to match your agent name as appropriate. This is important because each agent runs under a different service and they must have unique names, otherwise only one will connect at a time.
Now you can click OK on the popup.
And choose the defaults the rest of the way through the installer.
If you open Services
You should see the service you named.
The new agent should connect and be visible from the TeamCity Agents page within a few moments.
Repeat the steps to add additional agents.
Thank you for posting this. When I installed a second agent on my TC server it clobbered the first one.
Your post saved me considerable time figuring out where the service was defined. It seems like a bug that the build agent installer does not detect this though.
Thanks again.
THANKS for this. I suspected something like it, but your post confirmed my suspicions and saved me finding the workaround.
Thank you.
Editing wrapper.conf is tricky.
Never would have figured it out without this post. Thanks!
Thank you so much! This saved me a lot of grief.
thanks for the guide…
This is great but I guess installing the extra agent still knocks the counter down from the 3 that comes with Team City
Worked perfect! Thanks for the details.
Thank you for this post. But after installing the agent, do I need to run agent.bat file available under build agent\bin folder ??
Thanks for this wonderful share, it works well
Thanks, great article, saved me hours more pain, after the hours I already spent trying to figure this out myself 🙂
nice post. I figured out the issue while writing this into a DSC module, then saw this post. could have saved a few minutes, but…. it’s good to see I wasn’t off track: note, you don’t have to change the description, even though TC article recommends it.
6 years later, and this post is still super helpful. Thanks.
Yep awesome post thanks! Just used it for TeamCity 10 and still relevant.
Thanks for the awesome post. It appears somebody was able to take this knowledge and apply it to create a TeamCity Agent Chocolatey package. This is much nicer than using the .msi because then you can avoid the weirdness of having it installed multiple times but only showing up once in the Programs and Features.
The main thing it’s missing is the ability to set the service account to run as, but that can be changed fairly easily with a little scripting after the fact.
https://chocolatey.org/packages/TeamCityAgent