Running Scripts as Actions


Performance Logs And Alerts is the service responsible for handling alerts. To run batch scripts or any programs that launch command prompts or perform other actions that require access to the desktop, you'll need to configure the service so that it can interact with the desktop. To do this, complete the following steps:

  1. Click Start, choose Settings, click Control Panel, double-click Administrative Tools, and then click Services.

  2. Right-click Performance Logs And Alerts, and then click Properties.

  3. In the Log On tab, select the Local System Account and Allow Service To Interact With Desktop check boxes.

  4. In the General tab, click Start, and then click OK.

This allows the Performance Logs And Alerts service to execute batch (.bat, .cmd) and script (.js, .vbs, .wsf) files interactively. However, you can't enter the name of a Windows script directly in the Run This Program field. Instead, you must enter the path to the Windows Script engine that you want to run when the action is triggered, such as C:\WINDOWS\system32\Cscript.exe, and then set Command Line Arguments that point to the script you want to execute. To do this, follow these steps:

  1. Set up the alert. For the alert action, select Run This Program. Click Browse. Use the Select File To Run dialog box to find the full path to the Windows Script engine you want to use, such as C:\WINDOWS\system32\Cscript.exe. Click Open.

  2. In the Action tab of the alert Properties dialog box, click Command Line Arguments. In the Command Line Arguments dialog box, select Single Argument String and Text Message. Clear all other arguments.

  3. In the Text Message field, type the full path to the script, such as c:\scripts\Test.vbs.

  4. Click OK twice.

  5. Select the Schedule tab, and then specify when alerting starts and stops. For example, you could configure the alerts to start on a Friday evening and stop on Monday morning. Then each time an alert occurs during this period, the specified action(s) are executed.

  6. You can configure alerts to start manually or automatically at a specific date. Select the appropriate option, and then specify a start date, if necessary.

  7. You can configure alerts to stop manually, after a specified period of time, such as seven days, or at a specific date and time.

  8. When you've finished setting the alert schedule, click OK. The alert is then created, and you can manage it in much the same way that you manage counter and trace logs.



Microsoft Windows Server 2003 Administrator[ap]s Pocket Consultant
Microsoft Windows Server 2003 Administrator[ap]s Pocket Consultant
ISBN: 735622450
EAN: N/A
Year: 2003
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net