type: "io.kestra.plugin.scripts.powershell.Commands"
Execute one or more PowerShell commands. Note that instead of adding the script using the inputFiles
property, you could also add the script from the embedded VS Code editor and point to its location by path. If you do so, make sure to enable namespace files by setting the enabled
flag of the namespaceFiles
property to true
.
Examples
Execute PowerShell commands.
id: execute_powershell_commands
namespace: company.team
tasks:
- id: powershell
type: io.kestra.plugin.scripts.powershell.Commands
inputFiles:
main.ps1: |
'Hello, World!' | Write-Output
commands:
- ./main.ps1
Properties
commands
- Type: array
- SubType: string
- Dynamic: ✔️
- Required: ✔️
- Min items:
1
The commands to run.
interpreter
- Type: array
- SubType: string
- Dynamic: ❌
- Required: ✔️
- Default:
[ "pwsh", "-NoProfile", "-NonInteractive", "-Command" ]
- Min items:
1
Which interpreter to use.
warningOnStdErr
- Type: boolean
- Dynamic: ❌
- Required: ✔️
- Default:
true
Whether to set the task state to WARNING
when any stdErr
output is detected.
Note that a script error will set the state to
FAILED
regardless.
beforeCommands
- Type: array
- SubType: string
- Dynamic: ✔️
- Required: ❌
A list of commands that will run before the commands
, allowing to set up the environment e.g. pip install -r requirements.txt
.
containerImage
- Type: string
- Dynamic: ✔️
- Required: ❌
- Default:
ghcr.io/kestra-io/powershell:latest
The task runner container image, only used if the task runner is container-based.
docker
- Type: DockerOptions
- Dynamic: ❌
- Required: ❌
Deprecated - use the 'taskRunner' property instead.
Only used if the
taskRunner
property is not set
env
- Type: object
- SubType: string
- Dynamic: ✔️
- Required: ❌
Additional environment variables for the current process.
failFast
- Type: boolean
- Dynamic: ❌
- Required: ❌
- Default:
true
Fail the task on the first command with a non-zero status.
If set to
false
all commands will be executed one after the other. The final state of task execution is determined by the last command. Note that this property maybe be ignored if a non compatible interpreter is specified. You can also disable it if your interpreter does not support theset -e
option.
inputFiles
- Type:
- object
- string
- Dynamic: ✔️
- Required: ❌
The files to create on the local filesystem. It can be a map or a JSON object.
namespaceFiles
- Type: NamespaceFiles
- Dynamic: ❌
- Required: ❌
Inject namespace files.
Inject namespace files to this task. When enabled, it will, by default, load all namespace files into the working directory. However, you can use the
include
orexclude
properties to limit which namespace files will be injected.
outputDirectory
- Type: boolean
- Dynamic: ❌
- Required: ❌
- Default:
false
Whether to setup the output directory mechanism.
Required to use the expression. Note that it could increase the starting time. Deprecated, use the
outputFiles
property instead.
outputFiles
- Type: array
- SubType: string
- Dynamic: ✔️
- Required: ❌
The files from the local filesystem to send to Kestra's internal storage.
Must be a list of glob) expressions relative to the current working directory, some examples:
my-dir/
,my-dir/*/
ormy-dir/my-file.txt
.
runner
- Type: string
- Dynamic: ❌
- Required: ❌
- Possible Values:
PROCESS
DOCKER
Deprecated - use the 'taskRunner' property instead.
Only used if the
taskRunner
property is not set
targetOS
- Type: string
- Dynamic: ❌
- Required: ❌
- Default:
AUTO
- Possible Values:
LINUX
WINDOWS
AUTO
The target operating system where the script will run.
taskRunner
- Type: TaskRunner
- Dynamic: ❌
- Required: ❌
- Default:
{ "type": "io.kestra.plugin.scripts.runner.docker.Docker" }
The task runner to use.
Task runners are provided by plugins, each have their own properties.
Outputs
exitCode
- Type: integer
- Required: ✔️
- Default:
0
outputFiles
- Type: object
- SubType: string
- Required: ❌
vars
- Type: object
- Required: ❌
Definitions
io.kestra.core.models.tasks.NamespaceFiles
enabled
- Type: boolean
- Dynamic: ❌
- Required: ❌
- Default:
true
exclude
- Type: array
- SubType: string
- Dynamic: ❌
- Required: ❌
include
- Type: array
- SubType: string
- Dynamic: ❌
- Required: ❌
io.kestra.plugin.scripts.runner.docker.Cpu
cpus
- Type: integer
- Dynamic: ❌
- Required: ❌
io.kestra.core.models.tasks.runners.TaskRunner
type
- Type: string
- Dynamic: ❌
- Required: ✔️
- Validation RegExp:
\p{javaJavaIdentifierStart}\p{javaJavaIdentifierPart}*(\.\p{javaJavaIdentifierStart}\p{javaJavaIdentifierPart}*)*
- Min length:
1
io.kestra.plugin.scripts.runner.docker.Memory
kernelMemory
- Type: string
- Dynamic: ✔️
- Required: ❌
memory
- Type: string
- Dynamic: ✔️
- Required: ❌
memoryReservation
- Type: string
- Dynamic: ✔️
- Required: ❌
memorySwap
- Type: string
- Dynamic: ✔️
- Required: ❌
memorySwappiness
- Type: string
- Dynamic: ✔️
- Required: ❌
oomKillDisable
- Type: boolean
- Dynamic: ❌
- Required: ❌
io.kestra.plugin.scripts.exec.scripts.models.DockerOptions
image
- Type: string
- Dynamic: ✔️
- Required: ✔️
- Min length:
1
config
- Type:
- string
- object
- Dynamic: ✔️
- Required: ❌
- Type:
cpu
- Type: Cpu
- Dynamic: ❌
- Required: ❌
credentials
- Type: Credentials
- Dynamic: ✔️
- Required: ❌
deviceRequests
- Type: array
- SubType: DeviceRequest
- Dynamic: ❌
- Required: ❌
entryPoint
- Type: array
- SubType: string
- Dynamic: ✔️
- Required: ❌
extraHosts
- Type: array
- SubType: string
- Dynamic: ✔️
- Required: ❌
host
- Type: string
- Dynamic: ✔️
- Required: ❌
memory
- Type: Memory
- Dynamic: ❌
- Required: ❌
networkMode
- Type: string
- Dynamic: ✔️
- Required: ❌
pullPolicy
- Type: string
- Dynamic: ❌
- Required: ❌
- Default:
ALWAYS
- Possible Values:
IF_NOT_PRESENT
ALWAYS
NEVER
shmSize
- Type: string
- Dynamic: ✔️
- Required: ❌
user
- Type: string
- Dynamic: ✔️
- Required: ❌
volumes
- Type: array
- SubType: string
- Dynamic: ✔️
- Required: ❌
io.kestra.plugin.scripts.runner.docker.Credentials
auth
- Type: string
- Dynamic: ✔️
- Required: ❌
identityToken
- Type: string
- Dynamic: ✔️
- Required: ❌
password
- Type: string
- Dynamic: ✔️
- Required: ❌
registry
- Type: string
- Dynamic: ✔️
- Required: ❌
registryToken
- Type: string
- Dynamic: ✔️
- Required: ❌
username
- Type: string
- Dynamic: ✔️
- Required: ❌
io.kestra.plugin.scripts.runner.docker.DeviceRequest
capabilities
- Type: array
- SubType: array
- Dynamic: ❌
- Required: ❌
count
- Type: integer
- Dynamic: ❌
- Required: ❌
deviceIds
- Type: array
- SubType: string
- Dynamic: ✔️
- Required: ❌
driver
- Type: string
- Dynamic: ✔️
- Required: ❌
options
- Type: object
- SubType: string
- Dynamic: ❌
- Required: ❌