Video Screencast Help

How can I run a command only if a job fails?

Created: 30 Nov 2012 • Updated: 26 Feb 2013 | 1 comment
This issue has been solved. See solution.


I'm wondering if there is an easy way either by script, or within the BackupExec console itself to run a command only if a backup job fails?  I have a backup that fails on occasion and the easiest way to fix the backup is to reboot the target server cluster.  So my hope is to script a reboot sequence that kicks off only if the backup job fails, so that the next time it runs it should be successful.

Comments 1 CommentJump to latest comment

pkh's picture

You can use BEMCLI.  Use either the Wait_BEJob cmdlet or the Get_BEJobHistory to get the job history and then check the JobStatus attribute.  From there, you can use some other Powershell cmdlets to do what you want to do.

If you need help to get started with BEMCLI, read my article below

I have also written other articles on using BEMCLI for other tasks.  Go to the Articles section and use the Author filter to filter for my handle.