How to connect Jenkins slave from windows machine

Option: 1 starting Jenkins slave via Windows Scheduler

there is one big disadvantage.

If the job fails e.g. becouse broken network connection, Windows Scheduler can not restart the job automatically. Its triggered only on start up of windows machine

  • run Jenkins master in docker
  • configure Jenkins Master for connecting Jenkins slave
  • run Jenkins Slave on windows machine
  • create job for running on Jenkins slave(windows machine)
  • create new job in windows task scheduler and trigger with reboot windows machine

Run Jenkins master in docker

we need have installed docker at first.

$ git clone
$ ./automate_jenkins/

open http://localhost:1111/jenkins/pluginManager/ and login with name and password <admin>. Update all plugins and restart it.

open http://localhost:1111/jenkins/configureSecurity/ and check this settings.

Jenkins – Configure Global Security

now we can add our new slave with opening http://localhost:1111/jenkins/computer/

Manage nodes – new node
Manage jenkins – Manage nodes

if you save it and open again new node win10 you can see something like this.

On Windows Machine we need to have installed Java at first.

Next on windows machine we create folder C:\Jenkins and save there file agent.jar
Create new file StartUpJenkins.bat and copy and paste command

java -jar C:\Jenkins\agent.jar -jnlpUrl http://localhost:1111/jenkins/computer/win10/slave-agent.jnlp -secret <secret_key> -workDir "C:\Jenkins"

Create job for running on Jenkins slave (windows machine)

Lets create the new pipeline job

pipeline {
     parameters {
        choice(name: 'NODE', choices:['win10', 'master'], description: 'Choose which node to run.')
     agent { 
         label params.NODE 
    stages {
        stage('Example Build') {
            steps {               
                echo 'Hello, Maven'
                bat label: '', script: 'ipconfig  -all'
                bat 'mvn --version'
        stage('Example Test') {
            steps {
                echo 'Hello, JDK'
                bat 'java -version'

Jenkins job with parameters

for automate connection after restart you can use this procedure

Option: 2 starting Jenkins slave via Windows Sevices

  • download and extract last version of Windows Service Wrapper
  • prepare config file

go here download latetes version.
In my case I have

Extract context of file into c:\Jenkins\logger
rename c:\Jenkins\logger\WinSW.exe =JenkinsLogger.exe
create file c:\Jenkins\logger\JenkinsLogger.xml

  <name>Jenkins agent</name>
  <description>This service runs a slave for Jenkins continuous integration system.</description>
  <!-- <executable>C:\Java\jdk1.8.0_202\bin\java.exe</executable> -->
  <arguments>-Xrs -jar "c:\Jenkins\agent.jar" -jnlpUrl http://localhost:1111/jenkins/computer/win10/slave-agent.jnlp -secret <secret_key> -workDir "c:\Jenkins</arguments>
  <onfailure action="restart" delay="60 sec"/>
  <log mode="roll"></log>

install the service via this command

c:\Jenkins\logger\JenkinsLogger.exe install c:\Jenkins\logger\JenkinsLogger.xml

if you change config you can update the service by

c:\Jenkins\logger\JenkinsLogger.exe refresh c:\Jenkins\logger\JenkinsLogger.xml

We also change permission for our running service, but it depens what we want to do on Windows machine over Jenkins slave.

Windows 10 – Computer Management

Traditional Enviroment on Windows machine

  1. Create a file for PIP:
  2. C:\Users\Robotti\AppData\Roaming\pip\pip.ini:
    proxy = IP Address
  3. IE’s Settings → Compatibility View Settings (for some old pages)
  4. Install Libreoffice
  5. Install Google Chrome
  6. Install GIT for Windows (run git config –global http.proxy IP Address)
  7. Install Python 3.8 into c:\_SDK\Python38\
  8. download chromedriver from here
  9. Add following paths to windows’ system environment variables:
    <C:\Python38>; <C:\Python38\Scripts>
  10. create folder c:\virtualenvs
  11. C:\_SDK\Python\Python38\python.exe -m venv c:\virtualenvs\p383
  12. create file C:\_SDK\Python\myrequirements_p3.txt

install the requirements

C:\virtualenvs\p383\Scripts\pip3.8.exe install -r C:\_SDK\Python\requirements_p3.txt
Using Internet explorer for testing on windows machine over Jenkins slave.

If we want use Internet explorer we need download and install Webdriver for IE.
But there is one issue, if the jenkins slave runing as service does not have access for controlling Internet explorer over web driver.

SO the solution is download standalone Selenium server and run it as service. And use webdriver to control Internet explorer over Selenium Server.

So we need download and install latest stable Selenium Standalone server (grid).

  1. So lets create folder C:\SeleniumServer\ and download there jar file.
  2. Next we need copy folder c:\Jenkins\logger into C:\SeleniumServer\logger.
  3. Rename file C:\SeleniumServer\logger\JenkinsLogger.exe = SeleniumLogger.exe
  4. rename file Rename file C:\SeleniumServer\logger\JenkinsLogger.xml = SeleniumLogger.xml
  5. rewrite content of file SeleniumLogger.xml with following
  <name>Selenium Server service</name>
  <description>This service runs SeleniumServer server.</description>
  <!-- <executable>C:\Java\jdk1.8.0_202\bin\java.exe</executable> -->
  <arguments>-Xrs -Dselenium.LOGGER=C:\SeleniumServer\logger\logs\selenium.log -jar "c:\SeleniumServer\selenium-server-standalone-3.141.59.jar" -port "7777</arguments>
  <onfailure action="restart" delay="60 sec"/>
  <log mode="roll"></log>

Install Selenium server as Windows service by following command

c:\SeleniumServer\logger\SeleniumLogger.exe install c:\SeleniumServer\logger\SeleniumLogger.xml

In case that you want run some robot framework test with Internet explorer you need to change parameter for web browser like that


open browser  ie  remote_url=

you can find more info about running robotframework tests on windows here.

Leave a Reply

Close Menu