NOTE: if you installed Jenkins using the windows installer, you shouldn't need to do anything else here because the windows installer automatically runs Jenkins as a windows service.
First, you need to start Jenkins before installing it. This can be done from JNLP, or by running "java -jar jenkins.war".
Now connect to Jenkins by going to the following URL http://<hostname>:8080/
NOTE: The "Install as Windows Service" link indicated above will not appear if Jenkins is already running as a service on the machine. You can verifying that Jenkins is running as a service by launching the Services app from the Windows Start Menu and looking for a running service called "jenkins" among the list of all windows services running on the machine.
Clicking this link shows you the installation screen:
Choose the directory where Jenkins shall be installed (directory must already exist. If not create it before hand). This will become JENKINS_HOME and used to store data files and programs alike.
This is to re-launch Jenkins as a newly installed Windows service. When you click yes, you'll be asked to wait until the restart completes:
At this point you can use the service manager to confirm that Jenkins is running as a service.
Jenkins also allows you to install a slave agent as a Windows service. (See Distributed builds for more about how to do distribute builds in general.)
First, you configure your slave to run as a JNLP slave agent. This should create a JNLP launch icon in the corresponding page, as shown below:
From the slave machine, launch a slave agent. You should see a window like this:
Choose "File" > "Install as Windows Service" from the menu:
Confirm your intention to install as a service. The installation will place the program files to the directory designated as the slave root directory (from the "configure executors" screen.)
Once the installation succeeds, you'll be asked if you'd like to stop the current slave agent and immediately start a slave agent.
When you click "OK", the slave agent window will terminate. The new slave agent runs as a service without showing a window, so head over to the service manager from the control panel and confirm that the slave agent is indeed running as a service:
Warning: Hudson may reset this setting if it deploys a new Slave at any time.
On Windows Server 2008 R2 x64 to configure the service Jenkins to run as the desired domain user.
On the Jenkins install directory, grant All Privileges to the Jenkins domain user. You may have to delete all old LOG files, hudson-slave.err, hudson-slave.out, hudson-slave.wrapper and redirect for the service to start back up.
Grant read access to the Jenkins user on the following registry key:
Start the service back up and you should be able to run jobs as the domain user.
In a cmd execute the following command:
<serviceKey> is the name of the registry key that will define the service (this will not be displayed)
Note that one space after the "=" for each option is mandatory.
See the sc.exe reference for information on sc.exe
See also How To Create a User-Defined Service if you want to manually customize your service attributes.
You can also use instsrv instead of sc.exe:
If you are having trouble getting the Java Web Start agent installed as a Windows service an alternative method of starting the service automatically when Windows starts is to use the Windows Scheduler.
The JVM launch parameters of these Windows services are controlled by an XML file jenkins.xml and jenkins-slave.xml respectively. These files can be found in $JENKINS_HOME and in the slave root directory respectively, after you've install them as Windows services.
The file format should be self-explanatory. Tweak the arguments for example to give JVM a bigger memory.
Stdout and stderr from the service processes go to log files in the same directory.
To uninstall the jenkins slave service, run jenkins-slave.exe uninstall from the command line.
To uninstall the jenkins service, run jenkins.exe uninstall from the command line.
If the slave service doesn't start as intended, check the following locations for more information.
Skip to end of metadata Go to start of metadata