PowerShell Plugin

Plugin Information

Plugin ID powershell
Latest Release 1.2
Latest Release Date Aug 05, 2009
Plugin Central Plugin Central 3.2
Sources Subversion
Support Eclipse Hudson Forum
Issue Tracking Eclipse Bugzilla
Hudson Core (latest) 3.3.3

Integrates with Windows PowerShell by allowing you to directly write PowerShell scripts into the text box in Hudson. Other than that, this plugin works pretty much like the standard shell script support.

Changelog

Version 1.2 (Aug 5 2009)

  • Fixed a quotation problem.

Version 1.1 (July 1 2009)

  • Fixed a bug in the launch of PowerShell (patch)

Version 1.0 (June 16 2009)

  • Initial version

Labels:

plugin-builder plugin-builder Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Jan 11, 2010

    Brian J. Sayatovic says:

    The default execution policy of PowerShell seems to be Restricted, meaning it wo...

    The default execution policy of PowerShell seems to be Restricted, meaning it won't run any script files (it is restricted to just an interactive command console). But the PowerShell plugin creates a temp file (e.g. "hudson3492366779710559401.ps1") with the script content from the Job's configuration and then attempts to run it through powershell.exe. How does this mesh with that default execution policy? One option is to liberalize the execution policy (e.g. Set-ExecutionPolicy Unrestricted), but that is rather loose, applying to any script file. Is this what everyone else is doing?

    1. Feb 01, 2010

      Wim Rosseel says:

      The normal way woul be to set your policy to RemoteSigned. This will allow you t...

      The normal way woul be to set your policy to RemoteSigned. This will allow you to execute any local script and any remote script if it's signed in a trusted fashion.  So no need to open the door completely by setting to Unrestricted

      Now if this is still a problem I could investigate in signing the generated ps1 file such that thing could work with AllSigned as policy. Though that will anyhow require specifying and registering a valid trusted cert for signing.

      What might however do the trick also is letting you specify a ps1 file for yourself, such that your file gets executed. I was planning to add this extension anyhow. Perhaps I may find time to add this somewhere this week.

  2. Feb 04, 2010

    David Aldrich says:

    The PowerShell plugin fails for me unless I first execute 'Set-ExecutionPolicy ...

    The PowerShell plugin fails for me unless I first execute 'Set-ExecutionPolicy remotesigned' in a PowerShell window. This is messy and also won't be adequate when Hudson runs as a service.

    Wim wrote:

    > The normal way would be to set your policy to RemoteSigned.

    How do I do this please?

    Could the plugin not do this when it invokes the Hudson generated script (e.g. PowerShell -ExecutionPolicy remotesigned hudson3492366779710559401.ps1) ?

  3. Apr 07, 2010

    Michael Legner says:

    good plugin, but it has a big downfall: no return value. Even if the build fails...

    good plugin, but it has a big downfall: no return value. Even if the build fails, Hudson doesn't seem to recognize it and says everything is fine. So I switched back to Batch-Scripts with a command like " powershell.exe "& 'script.ps1'" "

    1. Aug 10, 2010

      Jamie Thomson says:

      Same problem here. If Hudson doesn't know that the build fails then that's a big...

      Same problem here. If Hudson doesn't know that the build fails then that's a big problem. I'm going to try Michael's batch-script-wrapper technique!

  4. May 06, 2010

    Varun Bhargava says:

    How can I pass arguments while calling a powershell script?

    How can I pass arguments while calling a powershell script?

  5. Aug 06, 2010

    Jamie Thomson says:

    Hello folks, I'm having issue with ExecutionPolicy too. I have opened up the Po...

    Hello folks,

    I'm having issue with ExecutionPolicy too. I have opened up the Powershell console as the same user that is running the Hudson service and issued "Set-ExecutionPolicy unrestricted". However, I'm still getting the following when executing any Powershell command from the build step:

    File C:\DOCUME~1\SVC_PR~1\LOCALS~1\Temp\hudson6647546035708680215.ps1 cannot be loaded because the execution of scripts is disabled on this system

    How do I tell Hudson to always run Powershell scripts with ExecutionPolicy="Unrestricted" (or RemoteSigned, whatever)?

    Thank you in advance!

    -Jamie

    1. Aug 10, 2010

      Jamie Thomson says:

      Hi, Installing Powershell v2 solved this problem. I have no idea why! but f...

      Hi,

      Installing Powershell v2 solved this problem. I have no idea why! but frankly don't care either :)

      -Jamie

      1. Aug 11, 2010

        David Aldrich says:

        Hi Jamie As I understand it, PowerShell v2 has solved the execution policy prob...

        Hi Jamie

        As I understand it, PowerShell v2 has solved the execution policy problem for you.

        What about the issue of not returning a pass/fail value? Is that still a problem?

        David

        1. Aug 17, 2010

          Jamie Thomson says:

          David, Nope, happy to say we solved that one too. At the end of the POSH script ...

          David,
          Nope, happy to say we solved that one too. At the end of the POSH script we have the following:

          exit $LastExitCode

          Easy when you know how! Hope this is useful to others.
          -Jamie

      2. Oct 06, 2010

        Earl Powers says:

        I actually found that simply installing v2 did not solve the execution problem.&...

        I actually found that simply installing v2 did not solve the execution problem.  I had to use set-executionpolicy RemoteSigned for it to work, but it now works.

    2. Jan 19, 2011

      Brian Mills says:

      I've had the problem with the temp powershell script "cannot be loaded because t...

      I've had the problem with the temp powershell script "cannot be loaded because the execution of scripts is disabled on this system".

      In my case, I already had Powershell 2 as I was on windows 7, but it was 64bit windows 7, and somebody installed the 32 bit version of Java to run hudson under (as they were used to working on XP). 32 bit Java can only run 32 bit batch shell's and powershell shell's.

      After uninstalling 32bit java, and installing 64 bit java, Hudson kicked off 64 bit batch and powershell shells and worked fine.

      You can check if you are in a 32 bit shell like this:

      • PowerShell run “Write $PSHome” and if you have a Wow64 directory in the path, you are in a 32 bit process
      • In command shell run “echo %programfiles%” and if the program files directory has (x86) in it, you are in a 32 bit process

      Hopefully that helps someone else.

      I still can't work out how to pass parameters to powershell scripts using this plugin. If I call this:

       .\Scripts\Deploy.ps1 -Environment tst

      The parameter tst is not found.

      Has anyone else worked out how to do that? (I can of course wrap powershell using a batch script like others have suggested, but I wanted to try using this plugin)