# Windows Server backup completed flag/alert set for triggering script

**URL:** <https://forums.powershell.org/t/windows-server-backup-completed-flag-alert-set-for-triggering-script/15268>\
**Category:** PowerShell Help\
**Created:** [November 22, 2020, 1:37pm UTC](https://forums.powershell.org/t/windows-server-backup-completed-flag-alert-set-for-triggering-script/15268 "2020-11-22T13:37:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arlesterc](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@arlesterc](https://forums.powershell.org/u/arlesterc)\
**Post date:** [November 22, 2020, 1:37pm UTC](https://forums.powershell.org/t/windows-server-backup-completed-flag-alert-set-for-triggering-script/15268/1 "2020-11-22T13:37:33Z")

</div>

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

&nbsp;

backup3 - backs up VM3

&nbsp;

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.

&nbsp;

Feedback is appreciated in advance.

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [November 22, 2020, 5:54pm UTC](https://forums.powershell.org/t/windows-server-backup-completed-flag-alert-set-for-triggering-script/15268/2 "2020-11-22T17:54:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![arlesterc](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@arlesterc](https://forums.powershell.org/u/arlesterc)\
**Post date:** [November 24, 2020, 4:02pm UTC](https://forums.powershell.org/t/windows-server-backup-completed-flag-alert-set-for-triggering-script/15268/3 "2020-11-24T16:02:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [November 24, 2020, 4:39pm UTC](https://forums.powershell.org/t/windows-server-backup-completed-flag-alert-set-for-triggering-script/15268/4 "2020-11-24T16:39:46Z")

</div>

```
Get-WBSummary
```

> **[Get-WBSummary (WindowsServerBackup)](https://docs.microsoft.com/en-us/powershell/module/windowsserverbackup/get-wbsummary?view=windowsserver2022-ps&viewFallbackFrom=win10-ps)**
>
> Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell.

---

<div class="post-metadata">

**Author:** ![arlesterc](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@arlesterc](https://forums.powershell.org/u/arlesterc)\
**Post date:** [November 24, 2020, 7:45pm UTC](https://forums.powershell.org/t/windows-server-backup-completed-flag-alert-set-for-triggering-script/15268/5 "2020-11-24T19:45:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![arlesterc](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@arlesterc](https://forums.powershell.org/u/arlesterc)\
**Post date:** [December 6, 2020, 1:56pm UTC](https://forums.powershell.org/t/windows-server-backup-completed-flag-alert-set-for-triggering-script/15268/6 "2020-12-06T13:56:20Z")

</div>

Any further input available?

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:28pm UTC](https://forums.powershell.org/t/windows-server-backup-completed-flag-alert-set-for-triggering-script/15268/7 "2024-05-16T20:28:11Z")

</div>

Closed on May 16, 2024, 8:28pm UTC


