Why can’t I get the Jenkins Powershell plugin to work?


Why can’t I get the Jenkins “Powershell plugin” to work?

I can run a powershell script on Jenkins using a “Execute windows batch command” build step with the following command:

But I am unable to run a powershell script with the Jenkins “Powershell plugin” using the “Windows Powershell” build step and this command, because of a Windows Execution policy not set error disallowing it to run:

Does anyone know the proper arg to give the Jenkins “Powershell Plugin” for it to succesfully run a script? Otherwise, I will just use the batch script work-around.


The correct thing to do is to set an execution policy on your machine (a one-time action), at which point you won’t need to bypass it every time, and the Jenkins plugin should “just work”. Are you unable to?

A reasonable starting setting would be RemoteSigned, which will allow you to execute local scripts fine but would still disallow scripts downloaded from the internet.

From an elevated PowerShell prompt, you would run:

See also: http://technet.microsoft.com/library/hh849812.aspx

UPDATE: excerpt from Help on applying policy and how it’s supposed to behave:

If you set the execution policy for the local computer (the default)
or the current user, the change is saved in the registry and remains
effective until you change it again.

Of course, if your machine is on a Domain, then Group Policy could revert this.


Why can’t I get the Jenkins Powershell plugin to work? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply