How to Install Several Windows Agents as a Service?


You want to connect multiple Windows agents, each installed as a service.



Java Web Start offers the possibility to connect multiple agents on the same machine. In addition, it is possible to install a JNLP agent as a service in Windows. Thus, this article is aimed to explain how to install multiple Windows agents as services.

Install Several Agents

1) Create an agent to launch via Java Web Start


2) There are different ways to launch the agent agent:

  • The easiest way is to access Jenkins from the agent machine, go to the node page computer/<my-node>/ and click on the Launch button. This downloads the file slave-agent.jnlp and runs it.
    • Another way is to run the command java -jar agent.jar -jnlpUrl http://<my-server>/computer/<my-node>/slave-agent.jnlp -secret <my-secret> described at computer/<my-node>/
    • You can download slave-agent.jnlp from the client master, copy it to the agent machine and run javaws slave-agent.jnlp


3) Once the agent is launched, you should see a popup in Windows. To install this agent as a service, click on File/Install as a service.

4) The service appears in the services popup. (run services.msc to see windows services). You can double click on the service to show its name:


5) All agents are installed with the same service display name in Windows: “Jenkins Agent”. In order to be able to install several agents, the displayname needs to be modified. Run the following command as an administrator to change the display name of the service.

> $ sc config <service-name> displayname="jenkins-agent-1"

6) In order to delete an already existing agent

> $ sc delete <service-name>

7) For each agent you want to add and install as a service, reproduce steps 1 to 6.


Configure Agent User

Although it is recommended to run master/agents with a single jenkins user, it is possible to run each agent as a different user. This can be configured in the agent service properties, in the logon tab. For example, the following agent is run with the user Administrator:


Further Information

Further documentation can be found on the wiki regarding Windows agent.

Have more questions?


  • 0
    Harsh Sarode

    awesome !! can you please help me about how to launch slave agent automatically via Launch method "Let Jenkins control this Windows slave as a Windows service" with using admin user i tried varied attempts for this but doesn't Jenkins server is Linux machine and slave node is Windows Server 2012 r2. i will be glad if i get solution.Thanks in advance.

  • 0
    Denys Digtiar

    Hi Harsh,

    This article is not related to the Launch method you are trying to use.

    Have you gone through the troubleshooting guide?

    If it didn't help you can request help on Users Mailing list or IRC. If you are a CloudBees customer feel free to raise a support ticket.

  • 0
    Radjammin Radjammin

    Step 2 , 3rd bullet. Creating a service is an administrator right.

    Edited by Radjammin Radjammin
Please sign in to leave a comment.