Microsoft Identity Integration Server 2003 Developer Reference

Example: Running Several Management Agents from a Command File

You can run a several management agents in a script. However, you may want to run a specified management agent only if the previous management agent run was successful. You can create a command file that can run other management agents only if the previous management agent run was successful. If the previous management agent run failed, then you can stop processing.

The following example shows you a command file that runs a management agent only if the previous management agent run was successful. The example assumes you have a script file called RunMA.vbs that runs a specified management agent and returns a value. The script uses named arguments to determine the management agent and run profile to run. For more information about creating a script file that uses named arguments, see Example: Specifying Management Agents From a Command Line.

The example runs the Fabrikam HR MA management agent with the full import run profile. If this management agent run is successful, then the Fabrikam AD MA management agent with a delta synchronization run profile is run. If the management agent run fails, then no further processing occurs.

If the first two management agent runs are successful, the Fabrikam LDAP Data Interchange Format MA management agent is run.

setlocal
set zworkdir=%~dp0
pushd %zworkdir%

RunMA /MA:"Fabrikam HR MA" /RunProfile:"Full Import"
if {%errorlevel%} NEQ {0} (echo Error[%ErrorLevel%]: command file failed) & (goto exit_script)

RunMA /MA:"Fabrikam AD MA" /RunProfile:"Delta Synchronization"
if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) & (goto exit_script)

RunMA /MA:"Fabrikam LDAP Data Interchange Format MA" /RunProfile:"Full Import CSV"
if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) & (goto exit_script)

:exit_script
popd
endlocal

See Also

Example: Running a Management Agent With a Specified Run Profile, Example: Specifying Management Agents From a Command Line