I do not understand the jobs status codes

Product: PowerShell Universal
Version: 3.7.7

I have jobs with PowerShell Exceptions that show green/success. It captures the pipeline error message and details under Errors.

I have jobs with a warning that shows yellow/warning

I have jobs with a warning and errors , but jobs shows as yellow/warning

I have jobs that are red/failed for system issue.

What is the proper way to have a job be red when there is any PowerShell error?
To me the job should show overall status of red if there were any errors.

If you change the ErrorAction to Stop in the job properties, it will fail the job if it encounters an error.

Thanks Adam. Sure setting the ErrorActionPreference to stop will do that. To me that is normal stuff and we already do this in our existing scheduled tasks. We run connect/collect/disconnect jobs on hundred+ servers and the scheduled jobs before PSU that log any errored item and continues processing the others. Now with PSU I was hoping the job would indicate in the status there was an error, but the job itself does not stop as there are most likely more items to process.

So my nice to have request would be to have the job indicate there were errors in the completed job, so the operator can investigate or setup triggers to notify support. Having errors during a job and status of success make it hard for support to know when there was an issue with the job in PSU. Suggest like the warning message, show error for any exceptions and failed for any stopping error.

So maybe something like Completed with Errors?

1 Like

I would really appreciate something like this. If we could have ā€œcompleted with errorsā€ be a trigger, even better! Iā€™d like to setup a process to send notifications when errors are detected without error action stop.

I would not mind the status of ā€˜error and redā€™ as technically the job did contain errors. Failed red is already there for stopping errors. Just not success and green if the job contains any errors IMO.

I really hope this is added as it would help seeing problems as a job operator that can quickly ID issues without having to look into each job for errors. Also it does not make sense IMO to create a script that looks for jobs with errors when the status makes more since. That way I also hope there would be a trigger that can be used to notify the job operator there were errors in the job.

Today I was looking at a job and saw that is was green/success, but it did have errors. The only way I know was by opening the job and seeing the errors otherwise I would not be aware of any errors occurred in the job run.

Yeah, weā€™re seeing this too. We want to generate errors that donā€™t stop the job, but still see there was an error that needs to be investigated.

Weā€™ll have this in 4.1. The new error status will be returned if a job has a non-terminating error.

image

3 Likes

Whatā€™s the expected timeline on 4.1? This is a useful feature for us. We kind of work with it but it makes way more sense for lots of jobs.

4.1 is scheduled for August.