windows

create an agent in Jenkins

config

install

install as a service

start service

[!DANGER] for v2.0

removed:

open the node connection page -> Launch -> File -> Install as a server

start server manually

setup jenkins-slave.exe

run as administrator

install and start service by cmd -> sc.exe

[!NOTE]

  • use instsrv instead of sc.exe:

    • Run path\to\instsrv "Jenkins Slave" path\to\srvany.exe

    • Run regedit

    • Create HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Jenkins Slave\Parameters

    • Add the following registry keys:

      • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Jenkins Slave\Description="Jenkins Continuous Integration Slave"

      • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Jenkins Slave\Parameters\AppParameters="-jar path\to\slave.jar -jnlpUrl http://jenkins-master:8080/computer/jenkins-slave/slave-agent.jnlp"

      • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Jenkins Slave\Parameters\Application="C:\WINDOWS\system32\java.exe"

sc

[!TIP]

  • service configuration

  • list all services

  • setup servicerestart when anything abnormal

remove service

remove service

[!TIP] or remove HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\jenkins

prepare

download agent.jar

download winws.exe and rename

references:

create xml

[!TIP] tips on xml label

  • <onfailure action="restart" />:

    onfailure action="restart"
  • <download from="https://jenkins.sample.com/jnlpJars/agent.jar" to="%BASE%\agent.jar"/>:

    2022-11-30 06:31:38,022 INFO - Downloading: https://jenkins.sample.com/jnlpJars/agent.jar to J:\jenkins\agent.jar. failOnError=False

install and start agent service

references:

[!TIP]

  • check available cli commands

winsw folder structure

stop services

tools

[!TIP] if Environment Variable changed in jenkins agent, the service requires to reboot again.

curl

[!NOTE|label:references:]

  • via scoop

  • via chocolatey

  • via manually

    • manually extract ( i.e. c:\tools\curl )

    • add c:\tools\curl\bin into Environment Variable

    • restart jenkins agent service

    RETURN
    ARCHITECTURE
    SYSTEM TYPE
    DOWNLOAD

    9

    x64 (AMD64)

    x64-based PC

    64-bit

    5

    ARM

    ARM64-based PC

    ARM64

    0

    x86

    x86-based PC

    32-bit

Q&A

a windows service must first be installed ( using installutil.exe )

windows server start error

[!TIP]

Last updated

Was this helpful?