Last updated on November 17, 2022
In this tutorial, you will learn how to start a Jenkins agent as a windows service. You need to download nssm service manager and add the path to the system environment variable. So that it can be accessible everywhere in the system.
Add nssm to the PATH variable in Windows
Check nssm installation
Download the agent.jar file from Jenkins
Let’s create a directory called c:\jenkins and place your agent.jar file in it.
Create Jenkins agent as a windows service
c:\jenkins>nssm install jenkins_agent "C:\Program Files\Java\jre1.8.0_311\bin\java.exe" "-jar C:\jenkins\agent.jar -jnlpUrl https://jenkins.arjunphp.com/computer/Pravinh/jenkins-agent.jnlp -secret 082da413f20a226e6043347f8f6a578e4ba1364a94807fb144d5e761f8627d2e -workDir C:\jenkins" Service "jenkins_agent" installed successfully!