ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Powershell Run Script Operator failure but the "Configure Powershell completes successfully

book

Article ID: 199578

calendar_today

Updated On:

Products

CA Service Management - Asset Portfolio Management CA Service Management - Service Desk Manager CA Process Automation Base

Issue/Introduction

When attempting to use the RunScript operator to start and run a Powershell command the command returns various errors from Powershell.  

The /PAM_PreDefinedContent/Utilities/01 Configure PowerShell/ sample processes run successfully including the final powershell Get-Date test operator.

The Powershell scripts themselves run without issue when called directly.

Cause

The issue seems to be environmental; where Java, or components of Powershell are not available when called from Process Automation. 

Environment

Process Automation 4.3 Sp3, 4.3 sp4, 4.3 sp5

Resolution

The issue was resolved by using full pathing details to JAVA and the powershell script in the command operator.

Example:

& 'C:\Program Files\Java\jdk1.8.0_231\bin\java.exe' -Xmx512M -cp "C:\Program Files\Java\jdk1.8.0_231\lib" -jar %1\lib\GRLoader.jar -s http://%2:8080/ -u %3 -p %4 -N %1 -cfg %1\site\cfg\\%5 -dbstmt %6 -a -ad tenant=lab1 -lttwa -e %1\log\Shipments-err.xml -E

After specifically defining Java and the Powershell in the Operator the Command Operator completes as expected.