Powershell backend vara with Write-Host throws Lines are not terminated in input text with CRLF
search cancel

Powershell backend vara with Write-Host throws Lines are not terminated in input text with CRLF

book

Article ID: 392543

calendar_today

Updated On: 03-31-2025

Products

CA Automic Workload Automation - Automation Engine CA Automic One Automation Automic SaaS

Issue/Introduction

When attempting to preview a backend variable with a command like:

powershell -command "IF(Test-Path 'C:\automic') {write-host 'this path exists'} ELSE {Write-host 'this path does not exist'}"

an error shows in the up that says:

U01002531 Lines are not terminated in input text with CRLF: 'this path exists '.

When running a prep_process_var against this backend variable, the script might stay in a Resolving Variables status.

Environment

Automic Automation v24

Cause

This is because Write-Host is used to write to the console window which is not available with backend variables.

Resolution

Using Write-Output or nothing will allow an output to be written.  Either:

powershell -command "IF(Test-Path 'C:\automic') {write-output 'this path exists'} ELSE {Write-Output 'this path does not exist'}"

or:

powershell -command "IF(Test-Path 'C:\automic') {'this path exists'} ELSE {'this path does not exist'}"