Starting with Windows Server 2008 and Windows Vista, you can now assign custom tasks (such as running a batch file, sending an e-mail alert, or popping up a message) via the Event Viewer when a specific event occurs. This can help you proactively track problems or issues with the system, applications, or network.
Open the Event Viewer, double-click the desired event, and click Attach Task To This Event from the Actions pane. Then follow the wizard, which will create an entry in the Windows Tasks Scheduler.