Powershell scripts are not executing properly when agent is started as a user

Document ID : KB000009279
Last Modified Date : 14/02/2018
Show Technical Document Details

When executing Powershell scripts via a batch file or wscript, the script may run but the commands in the script may not be completing their functions. 

E.g. If you have defined a command to zip or compress files in the Powershell script, the script may not be completing the function and no error is also reported.

CA Workload Automation DECA Workload Automation System Agent 11.3 for Windows

The Windows OS may have restricted execution policy.  This can prevent the script to be executed properly.  


If the CA WA Agent is started as local or domain user, then it will have very restricted privileges.  

When running Powershell scripts, make sure the Execution policy is set accordingly so that it can run properly.  The following command allows you to check the execution policy for a user:

Set-ExecutionPolicy -List | Format-Table -AutoSize

You can change the policy to Unrestricted for testing:

Set-ExecutionPolicy -Scope User -ExecutionPolicy Unrestricted 

You may additionally plan on running the agent as Local Service account.  This allows the process to have more privileges.

Additional Information:

You may add debug statement in your script when a commands and functions do not complete.  This can be helpful in understanding the exact cause of the errors.