Windows Server backup completed flag/alert set for triggering script

We are running Windows Backup using WBadmin commands. What we would like to do is have backups run consecutively once the previous back has completed - successfully or unsuccessfully. So let’s say there are three backup scripts -

backup1 - backs up VM1

backup2 - backs up VM2

 

backup3 - backs up VM3

 

What we would like to do is once backup1 completes - either successfully or not - just as long as when it’s finished that we get some alert/flag set so that backup2 can be triggered.

 

Feedback is appreciated in advance.

Are you executing backup using task scheduler ? You can try sending mail using Send-MailMessage cmdelt at the end of the backup script based on the backup status.

Thanks. However I need to know when the 1st backup has stopped running. How do I query for that from a script? So I run script one and it either does the backup or not but regardless I start the backup on the 1st backup having stopped - again regardless of stop condition. What is the flag for the status that a backup job is finished/not running any more?

Get-WBSummary

https://docs.microsoft.com/en-us/powershell/module/windowsserverbackup/get-wbsummary?view=win10-ps

Thanks. I’m not sure though how I would use this as part of a script. Are there different codes for different status of a job? So running is one code, completed is another, etc.? Also how would I monitor for that code? Because I have no idea when the job will be finished/come to a stop I have to have some monitoring process going on that will spot when the job stops. How do I setup that monitoring?

Any further input available?