Skip to content

Powershell

Overview

The Powershell node allows you to execute a predefined Powershell script within your automation workflow. This node retrieves the script associated with the current task from the server, executes it, and stores the results for use in subsequent nodes.


Purpose

Use this node to integrate any complex logic, file operations, system calls, or external command executions that are implemented in Powershell, directly within your automation workflows.


Inputs

This node does not require user-configurable inputs within the workflow configuration interface. The Powershell script is preconfigured on the server side and linked to the task by ID.

InputTypeDescription
(None)-No inputs are required for this node. The script is retrieved from the server based on the Automation ID and Task ID.

Outputs

Output Variable NameDescription
PSDataContains the output data from the executed Powershell script. This is stored within the task data dictionary under the key PSData.

Execution Details

  1. Validation:
    The node performs task validation but does not require specific user inputs.

  2. Script Retrieval:
    Retrieves the Powershell script associated with the task using:
    GetPowershellScriptAsync("Workflow", a.Id + "_" + taskParameters.taskId)

  3. Execution:
    Executes the script using the RunMeshDataPowershell method.

    • Passes the entire task data dictionary as the WFData parameter to the script.
    • The completed boolean indicates if execution was successful.
  4. Error Handling:

    • If script retrieval or execution fails, the node returns with taskSuccess = false and a failure message.
    • If successful, PSData contains the returned data, and the node completes with taskSuccess = true.

Example Use Cases

  • Running custom data processing or file operations not natively handled by built-in nodes.
  • Interfacing with local or network resources via Powershell.
  • Executing scripts that prepare, transform, or clean up files before further workflow steps.

Notes

⚠️ Important:

  • The Powershell script must be preconfigured and stored in the server with the correct naming convention to be retrievable by this node.
  • Ensure the script is idempotent and tested for production use, as any errors in the script will result in node failure.

Known Limitations

  • This node does not support dynamic input fields within the workflow configuration UI. Script parameters must be handled within the script logic or by modifying the WFData input dictionary.

Tentech 2024