Jenkins: centralizing the management of scheduled tasks


Windows Server 2019

Execution of a job by WinRM

WinRM is a protocol that allows remote administration of a Windows server. The use of job by WinRM allows batch and PowerShell commands to be run on remote servers without the need to install the agent.

The WinRM plugin must be installed.

To work, I had to join the server where Jenkins is installed on the domain.

From the Jenkins home page, create a new project by clicking New Item 1 .

New project - Jenkins

Name the job 1 , select Build a free-style project 2 and click OK 3 .

New project

Give a description 1 to the project then click on Build 2 .

Project configuration

Click the Add a step to build 1 button and select WinRM Client 2 .

Add step - Jenkins

Enter the DNS name of the remote server 1 and click Add / Jenkins 2 to configure credentials.

Configure remote host

Enter the identifier 1 and password 2 allowing the connection to the remote server. Click Add 3 to save them.

Credentials for WinRm - Jenkins Providers

Select the identifiers created. In the field Command 2 enter the command executed and click Save 3 .

Configure command

Now that the job is created, click on Start Build 1 .

Project added

Once it is executed, display the console output 1 .

go output console

The console output displays the result of the ipconfig command. You can also see at the beginning the connection to the remote server by WinRM.

WinRM - Jenkins - Result



Leave a Comment