TaskPS
class tasks.task_ps.TaskPS
Access a Windows Remote Management (WinRM) service.
This task enables you to interact with a Windows Remote Management (WinRM) service. See Windows Remote Management for information about WinRM.
Inputs
Name | Type | Default | Description |
---|---|---|---|
host | str | The hostname or IP of the remote windows host | |
message_encryption | str | auto | If to use message encryption. See Encryption |
password | str | The password to use for authentication | |
run_cmd | str | None | The command to execute on the remote windows host |
run_cmd_args | list | None | Arguments for the command executed by run_cmd |
run_ps | str | None | The powershell script to execute on the remote windows host |
transport | str | ntlm | Which transport to use. See Valid transport options |
username | str | The username to use for authentication |
Outputs
Name | Type | Default | Description |
---|---|---|---|
status_code | int | The status code of the executed command | |
std_err | str | The standard error of the executed command | |
std_out | str | The standard output of the executed command | |
execution_id | int | The ID of the task execution | |
message | str | The ended message for the task. If the task ended with an error, the message will contain information about what went wrong | |
status | str | The ended status for the task. Either "success" or "error". |
Constants
input_list = ['host', 'message_encryption', 'password', 'run_cmd', 'run_cmd_args', 'run_ps', 'transport', 'username']output_list = ['status_code', 'std_err', 'std_out']version = 1Methods
run ()
Example
import flow_apidef handler(system: flow_api.System, this: flow_api.Execution):this.task('PS',host='my-windows-host',username='kevin',password='secret',run_cmd='ipconfig',)this.task('PS',host='my-windows-host',username='kevin',password='secret',run_ps='Write-Host "Hello World!"',)return this.success('all done')