How to create a "Command Metric" and policy to run a vbScript that creates an output file
Last Updated September 13, 2012
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.
Open Home > Monitoring and Alerting then go to Monitor > Policies
Find the folder where the policy is to be stored in and right click it
Go to New > Monitor Policy (Agent-based)
Give the policy a name
Click the Add button under ‘Rules’
Click New > Metric
Give the new rule a name, assign it a category and click the New button under Metrics
Click Select metric
Click New > Command
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
Ensure the new metric is selected and click OK
In the New Metric evaluation, add a Value of “255”
Click OK twice.
Ensure the new Rule is selected and click OK
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
Imported Document ID: HOWTO79492
Subscribing will provide email updates when this Article is updated. Login is required to Subscribe