java -jar slave.jar \
-jnlpUrl http://build.myorg.com/jenkins/computer/windows-slave-1/slave-agent.jnlp
-auth scott:tiger
Once you have started the slave agent, be sure to install it as a Windows service, as discussed in the
previous section.
11.3.5. Starting a Windows Slave as a Remote Service
Jenkins can also manage a remote Windows slave as a Windows service, using the Windows
Management Instrumentation (WMI) service which is installed out of the box on Windows 2000 or later
(see Figure 11.14, “Letting Jenkins control a Windows slave as a Windows service”). When you choose
this option, you just need to provide a Windows username and password. The name of the node must
be the hostname of the slave machine.
This is certainly convenient, as it does not require you to physically connect to the Windows machine
to set it up. However, it does have limitations—in particular, you cannot run any applications requiring
a graphical interface, so you can’t use a slave set up this way for web testing, for example. In practice
this can be a little tricky to set up, as you may need to configure the Windows firewall to open the
appropriate services and ports. If you run into trouble, make sure that your network configuration allows
TCP connections to ports 135, 139, and 445, and UDP connections to ports 137 and 138 (see https://
wiki.jenkins-ci.org/display/JENKINS/Windows+slaves+fail+to+start+via+DCOM for more details).
Figure 11.14. Letting Jenkins control a Windows slave as a Windows service
11.4. Associating a Build Job with a Slave or Group of Slaves
In the previous section, we saw how you can assign labels to your slave nodes. This is a convenient way
to group your slave nodes according to characteristics such as operating system, target environment,
database type, or any other criteria that is relevant to your build process. A common application of