Huntland Services Ltd

Tel: +44 (0)1392-490518
Fax: +44 (0)1392-428003
Enquiries@huntland.co.uk

Status Message Filter to Execute Any Command

 

Back StatusMessageFilter.VBS


Have you ever tried to use a command other than net.exe send when configuring a status filter rule?  They don't work do they!  However this VbScript provides just that functionality.  Use this to execute any valid command such as emailing, sending  a text messages to your mobile phone, starting a remote control session and so on.

  You can run it from anywhere but you must have access to WMI on the SMS provider server.  The script runs a standard WMI intrinsic event query which polls at regular intervals.  Once the status message condition has been detected and the command run, the script exits.

Through a series of input boxes you define:

  1. What is the name of the SMS provider server?  
    This will probably be your SQL Database server. e.g. "Server1"

  2. What is the site code? 
    Your 3 character site code. e.g. "S00"

  3. What is the SMS component ? - The name of the component that generates the message e.g. "SMS_DISCOVERY_DATA_MANAGER".  Whatever you enter here will be checked against SMS and rejected if there is no match.  Case is not sensitive.

  4. What is the message id ?
    This is the number identifying the message.  You will probably need an existing message in the database in order to find what the number is.  Some numbers are generic e.g. 502 component has stopped, 500 component has started.

  5. What is the name of the machine where the message was generated?
    This is the machine where the component you configured in step 3 above, is running. 

  6. What is the full path of the program you want to run?
    e.g. C:\Program Files\doThis.exe

  7. How frequently do you want to poll WMI?
    This is a value expressed in seconds for how often WMI will check to see if the status message has arrived.  If you poll too often it will impose an overhead on WMI.  The default polling interval is set at 120 seconds.  

  8. For how many minutes do you want to filter messages?
    This is a value expressed in minutes.  At the end of this time, if there have been no status messages that meet your definition, the script terminates. This version of the script deliberately prevents configuring it to poll forever.

Finally you will be asked to verify your settings, the filter will be created and after a pause you click OK to start polling.

Please accept this script as is.  Any feedback will be gratefully accepted at Debug@huntland.co.uk