Add a Jenkins Node for Windows Powershell

Add a Jenkins Node for Windows Powershell

April 11, 2016 3 By Eric Shanks

Not all of your Jenkins projects will consist of “Hello World” type routines. What if we want to run some PowerShell jobs? Or better yet, PowerCLI? Our Jenkins instance was built on CentOS and doesn’t run Windows PowerShell very well at all. Luckily for us, in situations like this, we can add additional Jenkins nodes and yes they can also be Windows hosts!

Login to your Jenkins Instance and go to Manage Jenkins and then click on Manage Nodes.JenkinsWIN1

You should see the master Jenkins node listed already in the grid. Now click on “New Node” to add another Jenkins Node to the list.

JenkinsWIN2

Give the node a name and select “Dumb Slave”. JenkinsWIN3

Add a number of executors and a remote root directory. This controls how many simultaneous tests the new node can run at a time and what directory to be run under. The next item to select is the Launch Method. I’ve chosen to run the Jenkins agent through the Java Web Start. If this is a production instance you probably want to do this by adding a Windows service but this is a lab and is quicker to get up and running. Click Save.JenkinsWIN5

Configuration is done, now you should be able to see a new node in the list, but it’s got a dreary red “X” next to it. Click on the name of the new node.

jenkins-node1

Here we see some instructions on how to start the agent on the Windows Node. Copy the command from this site.
JenkinsWIN6

Open the URL from the windows node and wait for the Jenkins app to open and say “Connected.”JenkinsWIN7

Now if we look at the Jenkins Nodes again, we’ll see that they’re both online and ready to run our tests.

jenkins-node2

Summary

Now we can run both Linux tests as well as Windows tests on our shiny new Jenkins hosts. In the next post we’ll cover how to run a PowerShell script on our Windows machine.