Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell script to send email when backup is NOT completed successfully.

$
0
0

Windows Server 2012R2 Standard. I know enough about powershell scripts to be dangerous. So I figure its best to ask for help on this one. As you know, in the Windows Backup program the email feature is depreciated on server 2012. However, I had no problem customizing a powershell script I found so that it sends an email when the nightly backup is completed successfully. T'was easy to do. In task manager I just set the trigger to an event, with that event being Windows backup, and an event number 4 - which means backup completed successfully. This actually works great for my clients.  But this isn't what my client's want. (of course!)

Clients only desire to receive an email if the backup is not successful. But the reasons for a failed backup are numerous which can generate any number of errors in the event log. Since I'm just not that knowledgeable of powershell scripting, I'm hoping someone can help me here, or at least direct me to where I  can get help. Basically, I need a powershell script like this:

Trigger is "on eventID 14 (Backup Operation Completed)"

 If eventID in in the Microsoft-Windows-Backup/OPerational log preceeding the trigger event is not 4, then sendmail

The above would of course, include my already working sendmail script. Is this possible? Maybe someone's done it already? Any help would be appreciated.


Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>