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 https://github.com/devuserPP/automate_jenkins.git
$ ./automate_jenkins/start.sh
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.

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


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'
}
}
}
}

for automate connection after restart you can use this procedure
https://wiki.jenkins.io/display/JENKINS/Launch+Java+Web+Start+slave+agent+via+Windows+Scheduler
Option: 2 starting Jenkins slave via Windows Sevices
- download and extract last version of Windows Service Wrapper
- prepare config file
go here https://github.com/winsw/winsw/releases download latetes version.
In my case I have WinSW.NETCore.x64.zip.
Extract context of file into c:\Jenkins\logger
rename c:\Jenkins\logger\WinSW.exe =JenkinsLogger.exe
create file c:\Jenkins\logger\JenkinsLogger.xml
<service>
<id>JenkinsSlave</id>
<name>Jenkins agent</name>
<description>This service runs a slave for Jenkins continuous integration system.</description>
<executable>java</executable>
<!-- <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"/>
<startmode>Automatic</startmode>
<stopparentprocessfirst>true</stopparentprocessfirst>
<log mode="roll"></log>
<workingdirectory>C:\Jenkins\logger</workingdirectory>
<logpath>C:\Jenkins\remoting\logs</logpath>
</service>
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.

Traditional Enviroment on Windows machine
- Create a file for PIP:
- C:\Users\Robotti\AppData\Roaming\pip\pip.ini:
[global]
proxy = IP Address - IE’s Settings → Compatibility View Settings (for some old pages)
- Install Libreoffice
- Install Google Chrome
- Install GIT for Windows (run git config –global http.proxy IP Address)
- Install Python 3.8 into c:\_SDK\Python38\
- download chromedriver from here
- Add following paths to windows’ system environment variables:
<C:\Python38>; <C:\Python38\Scripts> - create folder c:\virtualenvs
- C:\_SDK\Python\Python38\python.exe -m venv c:\virtualenvs\p383
- create file C:\_SDK\Python\myrequirements_p3.txt
robotframework
robotframework-selenium2library
robotframework-seleniumlibrary
robotframework-jsonlibrary
requests
requests_ntlm
PyPDF2
PyMuPDF==1.16.3
xlrd
robotframework-SSHLibrary
python-docx
openpyxl==2.6.1
docx-mailmerge
google-api-python-client
oauth2client
extract-msg
yattag
robotframework-excellib
natsort
pdfminer
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).
- So lets create folder C:\SeleniumServer\ and download there jar file.
- Next we need copy folder c:\Jenkins\logger into C:\SeleniumServer\logger.
- Rename file C:\SeleniumServer\logger\JenkinsLogger.exe = SeleniumLogger.exe
- rename file Rename file C:\SeleniumServer\logger\JenkinsLogger.xml = SeleniumLogger.xml
- rewrite content of file SeleniumLogger.xml with following
<service>
<id>SeleniumServer</id>
<name>Selenium Server service</name>
<description>This service runs SeleniumServer server.</description>
<executable>java</executable>
<!-- <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"/>
<startmode>Automatic</startmode>
<stopparentprocessfirst>true</stopparentprocessfirst>
<log mode="roll"></log>
<workingdirectory>C:\SeleniumServer\logger</workingdirectory>
<logpath>C:\SeleniumServer\logger\logs</logpath>
</service>
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
google.robot
open browser https://www.google.com ie remote_url=http://127.0.0.1:7777/wd/hub
you can find more info about running robotframework tests on windows here.