Skip to main content

Invoke PowerShell

AutomatR.DefaultActivities.PowerShell.InvokePowerShell

The "Invoke PowerShell" activity in AutomatR allows you to execute PowerShell commands with specified input parameters. This activity leverages the power of PowerShell scripting within your automation workflows.

Properties

NameDescription
Input
CommandSpecifies the PowerShell command to be executed. The command should be provided as a string. String variables containing the PowerShell command.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variable or argument containing the desired display name.
Optional
DelaySpecifies the amount of time (in seconds) to wait before executing the "Invoke PowerShell" activity. This delay can be useful for handling synchronization issues. Integer variables containing the delay duration. Example: If the amount of time is 5 seconds, enter 5.
Output
ResultOutputs a collection of PSObject objects representing the result of executing the PowerShell command. This output can be used as input for subsequent activities in the workflow. Collection variables containing PSObject results.

How to use:

  1. Drag and drop the "Invoke PowerShell" activity onto the workflow.
  2. Configure the properties by specifying the PowerShell command to be executed and, optionally, set the delay.
  3. Execute the workflow to run the specified PowerShell command.
  4. The output, represented by a collection of PSObject results, can be utilized in subsequent activities within the workflow.

Example:

Consider an example where the "Invoke PowerShell" activity is used to retrieve a list of installed applications on a system:

Invoke PowerShell:
Display Name: "Get Installed Applications"
Params: "Get-WmiObject -Class Win32_Product | Select-Object Name, Version"
Result: installedApplications

In this example, the activity executes the PowerShell command to retrieve information about installed applications. The results, represented as a collection of PSObject objects, are stored in the variable "installedApplications" for further use in the workflow.