How to setup a Windows Agent to run Powershell jobs
search cancel

How to setup a Windows Agent to run Powershell jobs

book

Article ID: 88318

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

How to setup a Windows Agent to run Powershell jobs.
 

Detailed Description and Symptoms

By default, Windows agents cannot run Powershell scripts unless it's through a .bat file or command that can be run from the Windows command line. Below are instructions on setting up Powershell as an interpreter for Windows agents. As of V11.1 of the Automation Engine, this can be set up globally, no configuration of individual agents is required.

Note:  All agents on which this feature is used must also be V11.1 or higher.

Environment

Release: AUTWAB99000-11.0-Automic Workload Automation-Base Edition
Component:

Resolution

Configuration

In client 0, add a line to the variable UC_EXT_INTERPRETERS_WINDOWS in folder DIV_VARIABLES:

Key = POWERSHELL
Value 1 = .ps1
Value 2 = powershell.exe <FILE>

Ensure that the path to powershell.exe is included in the Windows PATH variable on all machines where Powershell scripts will be run.

If these are Agents upgraded in place (not new .ini files), please make sure the following lines are added in the global section:

ECPEXE=powershell.exe -NonInteractive -ExecutionPolicy bypass -NoLogo -file 
ECPEXT=ps1 

In versions before 11, the default for both parameters will be blank:

ECPEXE=
ECPEXT=


Usage

Use the following statements in the Process tab of a Windows job in order to use the Powershell interpreter (example):

:BEGIN_EXT_INTERPRETER POWERSHELL
 Test-NetConnection -ComputerName "<Automation Engine Server>" -Port 2217 -InformationLevel "Detailed"
:END_EXT_INTERPRETER POWERSEHELL

or:

:BEGIN_EXT_INTERPRETER POWERSHELL
 powershell.exe -file C:\testscript.ps1
:END_EXT_INTERPRETER POWERSEHELL