Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
It's not very straight-forward, and would depend on the specific 'details' you wish to gather, and for which event(s). Perhaps edit your question and provide those specifics? There's good info/tutorial on it here on Technet. – Ƭᴇcʜιᴇ007 Feb 12 '12 at 23:22
@techie007 thanks for reply. I've updated question – kurochenko Feb 12 '12 at 23:41
So all you want is an email when someone logs on? Do you need to know who logged on or anything like that? – Ƭᴇcʜιᴇ007 Feb 12 '12 at 23:44
Is there a specific event log entry you are attemping to base this off of? I'd use a different approach, create a Task that is triggered by login that runs a script to get current user and then email it. Such a script is pretty straight forward in PS. – edusysadmin Feb 12 '12 at 23:46
@techie007 yes, email with event message which can be seen in Event Viewer – kurochenko Feb 12 '12 at 23:46
up vote 4 down vote accepted

Use the task scheduler from the (Control Panel -> Administrator's Tools). It has the option to run a script, program or action, depending on some trigger (like someone logging on, running a program etc) Here's an example setup dialog (you are interested in the event "at log on") : enter image description here

share|improve this answer
And how do i get event message to emails body? – kurochenko Feb 13 '12 at 8:49
(First, in addition to manually creating the task above, you can more easily setup the task thru the event log. Find Event 4624 and pick "Attach taqsk to this Event..".) – jdh Feb 13 '12 at 16:41
Then the task needs to be exported (to an XML file), edited to include event fields and then imported back into the task scheduler as a new event. Here's an example of someone doing something similar -… – jdh Feb 13 '12 at 16:46

This seems simpler if you want the event text too

share|improve this answer
Can you please share actual solution instead of just posting a link? – Martin Prikryl Jan 15 '14 at 15:05
On an event is the option "Attach Task To This Event", here you can select an email action. If you want an attachment you can generate a file with a previous action and use that as attachment. – r03 Jun 20 at 8:21

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:

share|improve this answer
Need more than a link. Expand to show the solution other wise this is a trite answer and the link may eventualy break. – Carl B Mar 21 '14 at 7:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.