Nerd-cen-tric, adj. 1. Holding the view that technology is the center, object, and norm of all experience.

Schedule a Server to Email Event Logs

I recently needed to setup a way to email a weekly summary of event logs, here’s how I did it:

Powershell Script to Export Events

 Get-Eventlog -log WebEventLog -after ((get-date).addDays(-7)) -EntryType Error, Warning | export-csv "C:\scripts\sysevents.csv"

Email .csv File (emailEvents.ps1)

Send-MailMessage -To -From "" -Subject "[WebEventLog] Event Logs from servername" -Attachments "c:\scripts\sysevents.csv" -SmtpServer

Scheduled Command

powershell -command "& 'emailEvents.ps1' "

Comments are closed.

Nerdcentric Twitter Feed