I had 3 agents (A, B and C) and 3 windows services X, Y, Z. The agent A was pointing to service X, agent B was pointing to Y, and so on.
For test purposes, I´ve installed a fourth one (D), but I didnt know that my license was up to 3 agents only. So, the agent D was created with "Unauthorized with comment: Agent teamcityagentdev4 cannot be authorized because there is not enough licenses" status. Its understandable, but a weird thing happened. The windows service X that was pointing to agent A, began to point to new agent D. I stopped the service X, removed new agent D and then I started the service X again. I expected the service would point to agent A again, but it didnt happen. The agent A status remains "Disconnected (Agent has unregistered)".
How can I register that agent A again ?