Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Kevin Rood
2015-09-21T18:27:44Z
Hi Support,
Quick question, and it might be a simple answer I'm missing.
I've got a few Powershell scripts that look something like this:

if ("$Date" -eq "{DATENOWADD(Days|-2|yyyyMMdd)}") {
Write-Output "DC_Inv_{DATENOWADD(Days|-1|yyyyMMdd)}_*.csv"} else {
Write-Error "Kevin"}

On my servers on VC 7.1.4, the task errors, and the Error Output field contains only the text I specify ("Kevin" in this example).
But it seems like on VC 7.6.4, the task does not error. It is successful with "No Output" unless I specify -ErrorAction Stop
I understand that Write-Error is a non-terminating error, however, adding -ErrorAction Stop adds a whole bunch of other stuff into the error output:

ExecuteProcess("D:\Program Files\Decisions Made Easy\Visual Cron7\\TaskPowerShell.exe" 3751)->System.Management.Automation.ActionPreferenceStopException: Command execution stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Anand
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.Runspaces.Pipeline.Invoke()
at TaskPowerShell.PowerShellTaskClass.Run(ProcessPowerShellTaskInfoClass ti, StringBuilder& sbResultObject)
Exception in Task: ExecuteProcess("D:\Program Files\Decisions Made Easy\Visual Cron7\\TaskPowerShell.exe" 3751)->System.Management.Automation.ActionPreferenceStopException: Command execution stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Kevin
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.Runspaces.Pipeline.Invoke()
at TaskPowerShell.PowerShellTaskClass.Run(ProcessPowerShellTaskInfoClass ti, StringBuilder& sbResultObject)


The simple question is: In new versions of VC, how can I cause a Powershell task to fail and write the error output with only the text I specify, instead of all the other built-in PS error text?

Thanks!

Sponsor
Forum information
Support
2015-09-24T13:36:58Z
Hi Kevin,

please test this version: http://www.visualcron.co....aspx?g=posts&t=5159 

We have done some changes to the output.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top