Question

I was wondering if one could use a bat script to check event viewer for certain application errors, and if that error occurs, then it should call another bat file.

for example...

i have a bat file called reset_IE.bat which clears IE temp files, and resets it to factory default, which allready works.

how can i use cmd to check event viewer for a certain error, then run the reset_IE.bat if necessray.

the main bat file will eventually contain many check for various errors, for different software errors.

I found and example, with one of my users just now... where outlook keeps on asking for safemode and then restarts again... you need to delete outcmd.dat file...

How do i check eventviewer using wevutil.exe or any other util... to check application logs for Faulting application outlook.exe, and then call another bat file called something like fix_outlook_safemode.bat

which will in turn run

del "C:\Documents and Settings\%username%\Application Data\Microsoft\Outlook\outcmd.dat"
Was it helpful?

Solution

with windows2003 (maybe XP) you can use the built-in eventtriggers.exe utility

example this will execute raiseevent.cmd when a disk is full (eventid 2013 of source srv):

eventtriggers /create /TR "disk_full" /TK "C:\WINNT\system32\events\raiseEvent.cmd %computername% system 2013 Srv"  /EID 2013 /SO "Srv"

As you can see you can transmit whatever parameters you want to the batch

with win2k8 and 7 you can create a task in the taskscheduler that will be trigger if an event occurs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top