How to Modify the Control Script for Running Batch Files (319529)



The information in this article applies to:

  • Microsoft Metadirectory Services 2.1
  • Microsoft Metadirectory Services 2.2
  • Microsoft Metadirectory Services 2.2 SP1

This article was previously published under Q319529

SUMMARY

Running the Microsoft Metadirectory Services (MMS) management agents (MAs) by using the Schedule MA tool may not provide the flexibility that you want for running separate phases. This article describes how to modify the control script for running batch files.

MORE INFORMATION

By default, MAs run with the options that you set by using Compass. Compass is the MMS client. You may want to change the settings or to make sure that specific options are consistently set before you run a particular phase. This functionality is not included in the default capabilities of the MMS MAs. However, you can make some changes so that the MAs run from the command line by using batch files to expand their flexibility. Note that this technique does not prevent you from using the MMS schedule functionality.

If you use the method that is described in this article, you can set operational parameters in the MA control script and trigger them by using a command-line variable. This method prevents someone from accidentally changing the Operate MA parameters, which can cause unintended results. In particular, it is important to be able to force the MA mode to the correct value.

To use this method, you modify the MA control script to override the variables that you typically set in the graphical user interface (GUI). To edit the template:
  1. Log on to MMS as an administrator by using Compass.
  2. Click Bookmarks in the left pane, and then click Management Agents.
  3. In the right pane, click the appropriate MA.
  4. Click Actions in the left pane, and then click Design MA.
  5. Click the Control MA Operations tab.
  6. Click the MA Control Script tab.
  7. Edit the template code.
  8. To save the changes, click OK.
You can determine the variable names that are linked to Compass input fields by pausing the mouse pointer over a field in the GUI, and then holding down the CTRL key while you right-click the item. A ToolTip that contains the attribute name appears.

The following sample code contains an If-Then statement. This statement is evaluated if you set the command-line Action variable to IMPORT. This example is from a Microsoft Exchange LDAP MA. Note that the variables are specific to the MA that you are using.
# Custom Action definition for command-line support
IF %Action% = IMPORT THEN
    SET zcDsRole = "reflector"
    SET zcDsPerformDiscovery = "TRUE"
    SET zcDsPerformMetaSync = "TRUE"
    SET zcDsPerformUpdateCD = "FALSE"
    SET zcMAProcessHierarchicalStructure = "TRUE"
    SET zcMAProcessUsers = "TRUE"
    SET zcMAProcessLists = "TRUE"
    SET zcDsPerformInTestMode = "FALSE"
    SET zcDSPerformForeignUpdates = "FALSE"
    SET zcDSImportDelta = "FALSE"
    SET zcDSExportDelta = "FALSE"
    SET zcExchangeExcludeCustomRecipients = "TRUE"
    SET zcDSLogTransactions = "TRUE"
    SET zcDSImportUsesTransactionStack = "FALSE"
    SET zcDSAttributeFlowChanges = "TRUE"
    SET zcDSMAMaximumEntriesToProcess = ""
ENDIF
				
After you prepare the MA control script to evaluate the run-time parameters and you set the MA variables, a command-line call can trigger the appropriate behavior. For example, a sample command line to run an MA that is named MyMA might be:

c:\zoomserv\bin\zscript -dn "ma=MyMA,DsaName=MMS01,ou=Applications,dc=company,dc=com" -define "Action=IMPORT"

Note that the MMS server name is embedded in the control script (in this case, DsaName=MMS01).

Note that zcDsRole, which controls the mode, accepts reflector, link, and creator.

You can enter the command line in the Schedule tool's Command window. The MA operates according to both the defined schedule and the expanded command-line options.

Modification Type:MajorLast Reviewed:5/28/2003
Keywords:kbenv kbinfo KB319529