Online Help | Desktop App

Using PowerShell in workflow

Updated in 2023.2

The Alloy workflow engine integrates with PowerShell, a command-line shell and scripting language for automation tasks. This integration enables the direct execution of PowerShell scripts and commands within workflow actions and triggers, as well as the processing of script results within the workflow's programming logic. This page describes the execution environment of your PowerShell commands and scripts when used within the workflow.

There are three areas where PowerShell can be used in Alloy workflow:

  • External Command operations on the client
  • External Command operations on the server
  • PowerShell expressions

The execution context of PowerShell code varies depending on the initiator of the workflow item and its location within the workflow structure. This necessitates the availability of specific programs, modules, and libraries utilized by these PowerShell scripts. Refer to the table below to understand these distinctions.

Initiator External command on client External command on server PowerShell expression

Automation Server

Not supported
(see Client-on-server error)

Automation Server host

Automation Server host

An Alloy Navigator serviceClosed[Active Directory Import tool (ImportContacts), Alloy Discovery Connector, AlloyScan Connector, Mail Connector, Scheduled Task agent, and Reporting module (ReportCmd)] installed locally

Not supported
(see Client-on-service error)

Automation Server host

Computer hosting the service

Alloy Navigator Web App

User’s computer running the web browser

Automation Server host

IIS server hosting the Web App

Self Service Portal

User’s computer running the web browser

Automation Server host

IIS server hosting the Self Service Portal

API

Not supported
(see Client-on-API error)

Automation Server host

IIS server hosting the API module

Desktop App (being deprecated)

User's computer running the Desktop App

Automation Server host

User's computer running the Desktop App

Not supported scenarios result in errors as follows:

  • Client-on-server error: When the Automation Server attempts to trigger an External Command operation configured to run on the client, a corresponding error appears in the Workflow Log.

  • Client-on-service error: When a locally installed Alloy Navigator service attempts to trigger an External Command operation configured to run on the client, a corresponding error appears in the Workflow Log and the service's log.

  • Client-on-API error: When an action containing an External Command operation is initiated through the API, the operation will not execute the PowerShell script. Instead, the API will return the script’s source code in the response.