Jump to content

electro_wc

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by electro_wc

  1. 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)
×
×
  • Create New...