Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1419
  • Last Modified:

How to set up email notification for Windows event log error?

I have Windows 2008 server. I want to set up an automatic email notification when an error alert occurred and posted in Windows event. How to set up this? Do you have a tutorial or screenshot to show how to do that
0
wasabi3689
Asked:
wasabi3689
  • 9
  • 4
  • 2
5 Solutions
 
motnahp00Commented:
eventvwr.msc -> select a specific event -> right click and select Attach Task to this Event -> Action (send an email)
0
 
wasabi3689Author Commented:
I want all kind of error events to send email AUTOMATICALLY. If I select a specific event then set it up, does it mean I only receive email for this kind error???
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
AnuroopsunddCommented:
actually all this puts command and you can play with this. use wildcard instead of specific eventid and you will get all event id's

wevtutil qe System "/q:*[System [(EventID=20274)]]" /f:text /rd:true /c:1
0
 
motnahp00Commented:
You will be receiving a spam attack with a configuration like that. Look into event log forwarding instead.
0
 
wasabi3689Author Commented:
@Anuroopsundd

Where to put to your
wevtutil qe System "/q:*[System [(EventID=20274)]]" /f:text /rd:true /c:1

Can you attach a screenshot? I want once an error occurs, the email is fired automatically. If no error, no email fired

@motnahp00
How this work? I don't find where event log forwarding is. Can you attach a screenshot?
0
 
AnuroopsunddCommented:
0
 
wasabi3689Author Commented:
Hi,

I don't understand this following

1.
>>Perfect, so that’s what I want emailed to me. So let’s create a quick batch file which will >>get the above information and put it in a file. I just called it query.cmd and saved it on >>my desktop for convenience (again, the wevtutil command is all on one line).

What should I put in to query.cmd?

2.
>>del %temp%\query.txt
>>wevtutil qe System "/q:*[System [(EventID=20274)]]" /f:text /rd:true /c:1 > >>%temp%\query.txt

Use command line to run above?

3. how to use wildcard to replace "(EventID=20274"
0
 
AnuroopsunddCommented:
wevtutil qe System "/q:*[System]" /f:text /rd:true /c:1 >%temp%\query.txt

above query will bring the last entry from system logs.

if you change /c:100 you will get last 100 entries.
0
 
wasabi3689Author Commented:
Actually, I just need alert fired to my email once the error posted to event log. That means, if no error posted today, no need to send email, and if already sent out email alert for this instance, no need to send again. How to do that? I don't want to schedule the task to fire email everyday. I want to fire email only when error posted to event log. How to do that?
0
 
wasabi3689Author Commented:
Also, in the subject line, I want to pick up the source name with event ID

For example, Event 1009, DistributedCOM

How to do that?
0
 
wasabi3689Author Commented:
It sounds your command line only catches system log, I want to catch also application log and security log

wevtutil qe System "/q:*[System]" /f:text /rd:true /c:1 >%temp%\query.txt

When I catch System to Application, the email did not attach any thing, why?

wevtutil qe Application "/q:*[Application]" /f:text /rd:true /c:1 >%temp%\query.txt
0
 
wasabi3689Author Commented:
any comments for my questions?
0
 
wasabi3689Author Commented:
Hi,

I modified the script and I am able to capture both error thrown out from system and application.

Here is the script

Application error
del %temp%\application.txt
wevtutil qe Application "/q:*[System[(Level=1) or (Level=2)]]" /f:text /rd:true /c:1 >%temp%\application.txt

System Error
del %temp%\system.txt
wevtutil qe System "/q:*[System[(Level=1) or (Level=2)]]" /f:text /rd:true /c:1 >%temp%\system.txt

But, I still have an issue. The error email notification fired every night. Actually, I want them to fire only there error occurs. If no error occurs, no email fired. If error notification already fired, don't fire again.

How to do this and change the code.
0
 
wasabi3689Author Commented:
All ideas are very helpful here
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

  • 9
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now