Im playing around with Jenkins as its the CI tool of choice in my new job. One of the first things i wanted to do is run a PowerShell script, which it turns out is really rather easy.

First download the plugin (everything in Jenkins is achieved by adding a plugins!)

Jenkins -> Manage Jenkins -> Manage Plugins

Go to Available plugins and use the type “PowerShell” into the window

powershellinjenkins01

After installing it, we can now add a step in our Build using the PowerShell Plugin.

poshinjenkins01

From here we can just tell it to run out script so point to the file and away you go!

powershell -File U:\JenkinsScripts\UploadToSharePoint.ps1

poshinjenkins02

Note its also possible to just write:

U:\JenkinsScripts\UploadToSharePoint.ps1

In my example im running a script called UploadToSharePoint.ps1 which is U:\JenkinsScripts.

And that’s it.. click save and run. the powershell script is ran your onto the next task.

Advertisements