How do I send an email with event details when some event occurs in Windows 7, for example when any user logs on?
I've tried to use Event Viewer, but I haven't found out how to attach event details to the email's body.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
This seems simpler if you want the event text too
You need to export the job, edit XML file of the task and add value to ValueQueries. Import the job again and edit mail details. You can include Event Details and any information in the event.
Below article explains step by step on how to do the same: http://vijredblog.wordpress.com/2014/03/21/task-scheduler-event-log-trigger-include-event-data-in-mail/
ValueQueriesnode inside . Add
valuenodes inside it. For example:
<EventTrigger> ... <ValueQueries> <Value name="EventData">Event/EventData/Data</Value> </ValueQueries> ... </EventTrigger>
$(EventData)to include the event details
Please note that not all Windows Server versions admit this XML schema, but I guess that any recent version (WS2012 onwards) will be fine. For example: WS2008 (non R2), which uses http://schemas.microsoft.com/windows/2004/02/mit/task schema, does not like it.