This help page is for version 3.8. The latest available help is for version 8.1.

Execute Script Action

The Execute Script Action allows you to receive action parameters that were sent from a monitor and handle them in your own specific way.

The script is run using the computer's built-in VBScript interpreter. This means you can make use of the full VBScript language as well as any installed ActiveX/COM objects which are installed on the system.

Pressing the Test button will cause the script to execute immediately so you can test how it runs. One thing to keep in mind is which user the monitoring service is running as. If it isn't running as the same user that is currently logged in (which is seldom the case) it will have a different HKEY_CURRENT_USER registry hive, different drive mappings, different Internet Explorer settings, etc.

Since the monitoring service is not interactive, it is highly recommended that you not display any user interface (MsgBox, etc) from within the script since no users will be able to close the user interface (which will cause the thread running the script to never finish).

An example script that connects to a database is shown below

Option Explicit
Dim objconnection
Dim objrecordset
Dim strDetails

Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objconnection = CreateObject("ADODB.Connection")
Set objrecordset = CreateObject("ADODB.Recordset")

objconnection.Open _
"Provider=SQLOLEDB;Data Source=;" & _
"Initial Catalog=;" & _
"User ID=;Password=;"

objrecordset.Open "", objconnection, adOpenStatic, adLockOptimistic

PA Server Monitor