Windows Scripting Example using WMI and cwterm

From TDiWiki

Jump to: navigation, search

ConsoleWorks on Windows 2003 Server implements event action scripting using any normal scripting method available to the server including batch files, Perl (if installed) and Windows Script Host (VBSCRIPT or JavaScript). Below is a real-world example of how to use the ConsoleWorks WMI console and event action routines to implement a process to be sure that the Windows Event Forwarder is running on the node being monitored. This example is implemented on the DRAGENT_WMI console implemented on cwcluster.consoleworks.com (port 80).

The nodes involved in this operation are:
cwcluster.consoleworks.com (cwclu0.consoleworks.com or cwclu1.consoleworks.com)
dragent (a non-public node available only to the private cluster network adapters attached to cwcluster)

Here is the configuration of this example:

1. A WMI console is created to point to the node to be monitored (in this case, dragent).
2. A query is designed to check for the ConsoleWorksWEFService.
3. The WMI_WEF_PRESENT event is created to fire when the WEF Service is present on dragent.
4. The WMI_SCHEDULED_CHECKER event is created to be a timed event to check on the status of the WEF Service.
5. The WMI_SERVICE_RESTART event is created to alert the system administrators when the service is restarted.
6. The CHECK_EVENT_TAG.BAT action routine is created and associated with the WMI_SCHEDULED_CHECKER event and DRAGENT_WMI console.
7. The TAG_EVENT_HAPPENED.BAT action routine is created to tag a file when the WMI Poller identifies the WEF is present on dragent.

Here is the theory of operation of this example:

Personal tools