I'm having a heck of a time with this... burned a lot of time.
I have a script.ps1 file, in this file is a powershell function 'my_script' that takes an argumment $foo1 so like this:
script.ps1:
#requires -Version 2.0
function my_script {
param
(
[String]$foo1 = $(throw "Paramerter -foo1 [System.String] is required.")
)
begin
{
#---------- setup string variables --------------#
$MyToolLocation = "{0}\someplace\tools\" -f $foo1
...
}
process
{
...
}
end
{
...
}
}this script is located in my workspace from the root under Scripts\powerShell
I set my build task trying to use this as:
Script Location
[File]
[x] Run as Powershell script
Script file
script.ps1 ** I've also tried this: ${bamboo.build.working.directory}\Scripts\powershell\script.ps1
Argument
my_script -foo1 'Does not matter'
Working sub directory
Scripts\powershell ** I've also tried this: ${bamboo.build.working.directory}\Scripts\powershell
and no matter what I try I get this error:
Unable to find executable at C:\BuildDir\3112961-5472257\Scripts\powershell\script.ps1. Will try to run it anyway.
Executable? this is a script... but whatever... this script is in this location.
My only recourse to this point is to put my script inline, there must be some option for running from a script.. .how I do this from command line is:
powershell -ExecutionPolicy unrestricted command "& {.' command "& { . 'c:\work\Scripts\powershell\script.ps1'; my-function -foo1 'Does Not Matter'"Certainly this must be repeatable in Bamboo? How?