An Engineers Notebook

Send an E-mail deprecated in Server 2012 R2?

Why do Microsoft do this???

They giveth, and then they taketh away!


If you want task scheduler to send an email on event here is a workaround for the deprecated “Send an Email” option in the task scheduler.

This example will show you how to set up emails to be sent on Windows Server Backup Success and failure.
Backup Failure Email
1. Download sendEmail by clicking here
2. Copy the sendEmail.exe to a folder at C:backup_script
3. Open Notepad, paste this and save the file as a batch file:

sendEmail -f [email protected] -t [email protected] -u “TechShizz – HVExchange Full Backup Failure” -m Failure Event for Windows Server Backup has been logged. -s <serverIP> -xu SMTP_Username -xp SMPT-Userpassword

 
4. Open task scheduler (taskschd.msc) and create a task.
a. Create a custom trigger which will cover all failed backup events – you can use this XML query:
 
<QueryList>
<Query Id="0" Path="Application">
<Select Path="Application">[System[Provider[@Name='Microsoft-Windows-Backup'] and (EventID=5 or EventID=8 or EventID=9 or EventID=17 or EventID=22 or EventID=49 or EventID=50 or EventID=52 or EventID=100 or EventID=517 or EventID=518 or EventID=521 or EventID=527 or EventID=528 or EventID=544 or EventID=545 or EventID=546 or EventID=561 or EventID=564 or EventID=612)]]</Select>
<Select Path="Microsoft-Windows-Backup">[System[Provider[@Name='Microsoft-Windows-Backup'] and (EventID=5 or EventID=8 or EventID=9 or EventID=17 or EventID=22 or EventID=49 or EventID=50 or EventID=52 or EventID=100 or EventID=517 or EventID=518 or EventID=521 or EventID=527 or EventID=528 or EventID=544 or EventID=545 or EventID=546 or EventID=561 or EventID=564 or EventID=612)]]</Select>
</Query>
</QueryList>
 
b. Set the Action to run the batch file you created earlier.
 
5. Test the task by right clicking on it and running it manually.

Backup Success Email
Repete the above steps but use this for the batch file:

sendEmail -f [email protected] -t [email protected] -cc [email protected] -u “TechShizz – HVEXCHANGE2016 Full Backup Success” -m Event ID 4 For Windows Server Backup has been logged:The backup operation has finished successfully. -s <serverIP> -xu SMTP_username -xp userpassword

Leave a Reply

Your email address will not be published.