Powershell templates

Is there a way to create a powershell script that is shared by all steps? I’m repeating the script in my pre and post scripts and it feels dirty to me. It would be nice to have a repository of powershell scripts that Octopus has and then each project could call functions within those scripts. Is there a way to do that?

Hi Dan,

You might like to look at the following blog post which gives some ideas around how scripts can be shared across projects:

Paul

We have a common set of Powershell scripts that are:

  1. Copied into the project root using xcopy as a prebuild step from the common src location (which is in source control)
  2. Included in the project as content
  3. But the actual file on disk is not in source control

So when we build locally and in TeamCity, the scripts magically show up where they need to be and get bundled up, but we only have one location we need to edit them at.