"Unexpected token '&01' in expression or statement." via Powershell script in a JOBS object
search cancel

"Unexpected token '&01' in expression or statement." via Powershell script in a JOBS object

book

Article ID: 90534

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

When attempting to run a JOBS that uses Powershell as a Windows Interpreter the job fails and the report results appear similar to:

At D:\opt\uc4\qa_Agent\TEMP\JDLEOLUR.TXT.ps1:2 char:5
+ '   User input -> '&VARNAME#'='entered value'
+     ~~~~
Unexpected token 'User' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : UnexpectedToken

Job fails then with Ended abnormally.

Environment

Automic version 21.0.X

Cause

The Windows Header information is being used when a :READ statement is ran. Powershell attempts to interpret this directly which causes the 'Default' line to be entered and subsequently throw the error.

Resolution

Use the "I" parameter for Input Handling in your :READ statements to suppress documentation generation:

:READ <Variable>,,,,"I"

More information can be found in the READ documentation