How to create a "Command Metric" and policy to run a vbScript that creates an output file

Article:HOWTO79492  |  Created: 2012-09-13  |  Updated: 2012-09-13  |  Article URL
Article Type
How To

For these instructions, it is assumed the vbs file needed to run is in a folder on the root of C called "Command".  It is also assumed the output file desired will be created in that same location.

  1. Open Home > Monitoring and Alerting then go to Monitor > Policies
  2. Find the folder where the policy is to be stored in and right click it
  3. Go to New > Monitor Policy (Agent-based)
  4. Give the policy a name
  5. Click the Add button under ‘Rules’
  6. Click New > Metric
  7. Give the new rule a name, assign it a category and click the New button under Metrics
  8. Click Select metric
  9. Click New > Command
  10. Name the new metric and configure. For a simple execution of the file, leave all the defaults and only make the following edits:
    • Select the radio button for “Command Line.” In the command line window type the following:  cscript c:\Command\<fileName>.vbs > c:\Command\<OutputFileName>.txt (cscript is a native windows command that can be used to run vbs files.  The greater than (>) between the file names dictates the vbs file put the output file to that location)
    • Add a return value of 255
  11. Click OK
  12. Ensure the new metric is selected and click OK
    • In the New Metric evaluation, add a Value of “255”
  13. Click OK twice.
  14. Ensure the new Rule is selected and click OK
  15. Add your targets and enable the policy.

Once the policy gets downloaded to the agent, the command line will run and there should be a file called <OutputName>.txt in the C:\Command folder

Article URL

Terms of use for this information are found in Legal Notices