The system can be configured to run external scripts under several conditions:
- When object properties are modified.
- When zone contents are changed.
- When the number of free addresses in subnets go below a set threshold.
Scripts associated with object types are often used to perform lookups in external data sources and return data from these sources. To configure the system to run a script when properties for an object are modified or when zone contents are changed, do the following:
- Log in as Administrator.
- From the menu, select Tools, System Settings.
- In the System settings dialog box, click the External Commands tab.
- In the applicable field (e.g., Range script, IP Address script, etc.), type the script name and necessary startup parameters. You must enter all information for the script as you would when invoking the script from the command line. It is assumed that the script is located in the same directory as Men & Mice Central; however, if the script is stored in a different location, the path for the script must be entered. Example 1: Running a script named mytest.vb. To run a script named mytest.vb that is located in the Men & Mice Central directory using the scripting host cscript, the following would be placed in the appropriate field: cscript /B mytest.vb Example 2: Running an executable named checkdata.exe. To run an executable named checkdata.exe that is located in the Men & Mice Central directory the following would be placed in the appropriate field: checkdata.exe.
- Click OK.
When Men & Mice Central runs an external script, it sends an XML structure as an argument to the script being called. The XML structure contains information about all custom properties that are defined for the object type. The XML structure also contains the login name of the user that triggered the script.
The XML structures differs a little depending on the type of script (property change, zone contents change, scope monitoring).
Property Change Script Interface
The XML schema for a property change script is as follows:
An example XML structure with three custom properties named Location, Country and Region might look as follows:
Upon completion, the script must create a new XML structure and return it to Men & Mice Central. The schema for the XML structure that is returned is as follows:
An example XML structure with three custom properties named Location, Country and region might look as follows:
Men & Mice Central uses the information in the XML structure to update other custom properties or to display an error message if the success attribute on the result element is set to 0. The following XML example shows how an error message can be returned by the external script.
The XML structure is not required to return information about all custom properties, only fields that the script has changed. Unknown property fields are ignored by Men & Mice Central.
Zone Content Change Script Interface
The XML schema for a zone content change script is as follows:
An example XML structure for a zone change script might look as follows for a zone that exists in a view:
A zone content change script does not have any return value.
Subnet Monitoring Script Interface
The XML schema for a subnet monitoring script is as follows:
The value of the thresholdType element will be either static or dynamic depending on whether the threshold being crossed is one of dynamically allocatable addresses (i.e., available addresses in address pools) or if it is a threshold set for static addresses (i.e., available addresses outside of address pools).
An example XML structure for a subnet monitoring script might look as follows for scope:
A subnet monitoring script does not have any return value.
Example Visual Basic Script
The following example script, written in Visual Basic, shows how a script could return different values depending on the user that is running the script. The script is called when an object property changes.
Example PowerShell Script
- Copy the psExec.vbs and the
c:\ProgramData\Men and Mice\Centraldirectory.
- In Tools->System Settings->Monitoring, add it in the Default scope monitoring settings as follows:
then configure a dynamic threshold. The monitor will be executed every 10 minutes during the DHCP synchronization interval.