Published August 01, 2018 by

Run Powershell scripts in Jenkins

Jenkins has been primarily used for automating jobs and tasks on Linux servers. In this tutorial, we will be configuring Jenkins to execute Powershell scripts on Windows.

Powershell Plugin

Jenkin’s Powershell plugin is a useful tool for running Powershell scripts on Windows machine via Jenkins.

Plugin installation

1. Login to Jenkins and navigate to Manage Jenkins > Manage Plugins.

2. Click on the Available tab and Enter PowerShell in the filter box.

3. Select the plugin showing by name PowerShell Plugin.

4. Click on Install without restart.

The PowerShell plugin is now installed. and we can use in a Jenkins job.

Use PowerShell

In Jenkins Job Scroll down to the Build option and Add build step.

Select Windows PowerShell, inside the text box where the below Powershell script is to be supplied:

Here you can write PowerShell script according to your requirements.