en-US/about_Whiskey_PowerShell_Task.help.txt
TOPIC
about_Whiskey_PowerShell_Task SUMMARY Executes PowerShell tasks. DESCRIPTION The PowerShell task runs PowerShell scripts. You specify the scripts to run via the `Path` property. Paths must be relative to the whiskey.yml file. Pass arguments to the scripts with the `Argument` property, which is a hash table of parameter names and values. PowerShell scripts are run in new, background processes. The PowerShell task runs your script in *all* build modes: during builds, during initialization, and during clean. If you want your script to only run in one mode, use the `OnlyDuring` property to specify the mode you want it to run in or the `ExceptDuring` property to specify the run mode you don't want it to run in. The PowerShell task will fail a build if the script it runs returns a non-zero exit code or sets the `$?` variable to `$false`. To receive the current build context as a parameter to your PowerShell script, add a `$TaskContext` parameter, e.g. param( [object] $TaskContext ) This is *not* recommended. PROPERTIES * **Path** (mandatory): the paths to the PowerShell scripts to run. Paths must be relative to the whiskey.yml file. Script arguments are not supported. * **Argument**: a hash table of name/value pairs that are passed to your script as arguments. The hash table is actually splatted when passed to your script. EXAMPLES ## Example 1 Build: - PowerShell: Path: init.ps1 Argument: Environment: "Dev" Verbose: true Demonstrates how to run a PowerShell script during your build. In this case, Whiskey will run `.\init.ps1 -Environment "Dev" -Verbose`. ## Example 2 Build: - PowerShell: ExceptDuring: Clean Path: init.ps1 Argument: Environment: "Dev" Verbose: true Demonstrates how to run a PowerShell script except when it is cleaning. If you have a script you want to use to initialize your build environment, it should run during the build and initialize modes. Set the `ExceptDuring` property to `Clean` to make that happen. ## Example 3 Build: - PowerShell: OnlyDuring: Clean Path: clean.ps1 Demonstrates how to run a PowerShell script only when running in clean mode. |