Job That Runs PowerShell Script Hangs in RUNNING Status


Article ID: 7591


Updated On:


CA Workload Automation AE - Business Agents (AutoSys) CA Workload Automation AE - Scheduler (AutoSys) CA Workload Automation Agent


A command job that executes a PowerShell script on a Windows 2012 R2 agent is hanging in the RUNNING status. The same script can be run successfully from the command line. The job's command is set to run "powershell.exe" from the C: drive. However, the script is located on a network share.


This issue will occur if the PowerShell script requires user input to proceed. By default, WAAE command jobs on a Windows agent run in batch mode which means any prompts for user input would not be available for response. Therefore, if the script requires input, the job will stay in a RUNNING state because the script is not able to proceed and complete normally.


Release: ATSYHA99000-11.3.6-Workload Automation AE-High Availability Option


To successfully run a command job on a Windows agent in batch mode, the script/executable cannot require user input to run completely. There are two possible resolutions to this type of issue.

1. To continue running the job in batch mode, the script/executable must be coded so that it does not require user input to complete.

2. If the script/executable cannot be coded to run without user input, the job's "interactive" attribute can be set to "y". This will run the job interactively on the Windows agent. For this to work properly, the user that owns the job must be logged on to the Windows agent machine when the job starts. At that time, the user will see the Windows Command Prompt open in their session and will be allowed to interact with the job as it runs.