mitchell1981 Posted September 3, 2012 Posted September 3, 2012 I've just discovered that the ability to send an email based on an event, or a task has been deprecated. I've always found this quite useful for spotting when backups fail, or when syncs have happened etc.. A quick google search does not give any reason why Microsoft have decided to drop this functionality, nor can I find if there is now an alternative recommended way of getting a notification based on a event. Anyone found a way? I'm guessing it may be too early to ask a question like this!
electro_wc Posted September 24, 2012 Posted September 24, 2012 (edited) Here's a quick little powershell script that does it for me. I set up event viewer to run it on the administrative events filter. #Get the app log minus the annoying warnings from MSCVCR that occur because I don't own my domain/tree. #Only grab the previous 2 minutes - this could probably be shortened. $logapp = get-eventlog -LogName Application -after ([DateTime]::Now.AddMinutes(-2)) -EntryType Warning,Error | where-object {$_.EventID -ne 12339 -and $_.EventID -ne 12344} | fl | out-string #Get the system log -- only warnings & errors $logsys = get-eventlog -LogName System -after ([DateTime]::Now.AddMinutes(-2)) -EntryType Warning,Error | fl | out-string #Grab the hardware log (everything) $loghrd = get-eventlog -LogName HardwareEvents -after ([DateTime]::Now.AddMinutes(-2)) | fl | out-string #Setup a string to go out in the email $x = @" Applog $logapp Syslog $logsys Hardware $loghrd "@ $smtpServer = "smtp.mydomain.edu" $msg = new-object Net.Mail.MailMessage $smtp = new-object Net.Mail.SMTPClient($smtpServer) $msg.From = "[email protected]" $msg.To.Add("[email protected]") $msg.subject = "MyMachine Syslog" $msg.body = $x $smtp.Send($msg) I've just discovered that the ability to send an email based on an event, or a task has been deprecated. I've always found this quite useful for spotting when backups fail, or when syncs have happened etc.. A quick google search does not give any reason why Microsoft have decided to drop this functionality, nor can I find if there is now an alternative recommended way of getting a notification based on a event. Anyone found a way? I'm guessing it may be too early to ask a question like this! Edited September 24, 2012 by electro_wc
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now