Microsoft KB Archive/281701

= How to Schedule Management Agents with a Batch File =

Article ID: 281701

Article Last Modified on 10/2/2003

-

APPLIES TO


 * Microsoft Metadirectory Services 2.2 Service Pack 1

-



This article was previously published under Q281701



SUMMARY
This article describes how to schedule management agents (MAs) to run by using a batch file. This article describes how to write the batch file and schedule it to run by using the using the Microsoft Windows 2000 Task Scheduler tool.



MORE INFORMATION
 Create a command-line script to schedule the MA. This method of scheduling MAs includes writing a batch file to start each MA sequentially. The following sample batch file demonstrates a script that you can use in a batch file or program file. You then use the Windows 2000 Task Scheduler tool to start the file.

Use the following script to run all MAs sequentially:  Start Notepad and type the following information. This is a sample script for a delta run:

Echo Starting run of Exchange MA

f:\zoomserv\bin\zscript -dn &quot;ma=EXCHMA1,DsaName=Server1,ou=Applications,dc=microsoft,dc=com&quot; -define &quot;Action=DELTA&quot;

Echo End of Exchange MA

Echo Starting run of TAMA MA

F:\zoomserv\bin\zscript -dn &quot;ma=Provisioning Agent,DsaName=Server1,ou=Applications,dc=microsoft,dc=com&quot;

Echo End of TAMA

Echo Starting Delta run of ADMA

f:\zoomserv\bin\zscript -dn &quot;ma=ADMA,DsaName=Server1, ou=Applications,dc=microsoft,dc=com&quot; -define &quot;Action=DELTA&quot;

Echo End of ADMA

This is a sample script for a full run:

Echo Starting run of Exchange MA

f:\zoomserv\bin\zscript -dn &quot;ma=EXCHMA1,DsaName=Server1,ou=Applications,dc=microsoft,dc=com&quot; -define &quot;Action=FULL&quot;

Echo End of Exchange MA

Echo Starting run of TAMA MA

F:\zoomserv\bin\zscript -dn &quot;ma=Provisioning Agent,DsaName=Server1,ou=Applications,dc=microsoft,dc=com&quot;

Echo End of TAMA

Echo Starting run of ADMA

f:\zoomserv\bin\zscript -dn &quot;ma=ADMA,DsaName=Server1, ou=Applications,dc=microsoft,dc=com&quot; -define &quot;Action=FULL&quot;

Echo End of ADMA

NOTE: These samples are designed only as an example. You must adapt these examples to your situation and MAs.

 Save the file as Scheduler.bat in the C:\Zoomserv\Bin folder.

NOTE: To effectively make use of the -define statement in these scripts, see the following Microsoft Knowledge Base article, which describes how to use the zscript -define parameter to control Management Agents:

297884 How to Use the Zscript '-define' Parameter to Control Management Agents at Run-Time

  Use one of the available scheduling services to schedule the batch file. The scheduling services that are available include: Microsoft Window NT 4.0 Server:

 The At.exe command-line scheduler The WinAT scheduler from the Microsoft Windows NT 4.0 Resource Kit</li></ul>

Windows 2000 Server:

<ul> Task Scheduler</li> At.exe</li></ul>

Using Task Scheduler in Windows NT 4.0 with Microsoft Internet Explorer 4.0 or Later
 In the Winnt\Tasks folder in Windows NT Explorer, double-click Add Scheduled Task.</li> Click Next.</li> Click Browse.</li> In the Select Program to Schedule dialog box, browse to the C:\Zoomserv\Bin folder.</li> Click Scheduler.bat, and then click Open.</li> Click One time only, and then click Next.</li> Change the start time to about two minutes ahead of the current time; leave the start date set to the current date.</li> Click Next. You see the screen for the user account that the task will use. Type the user name and password that you are currently logged on with.</li> Click Finish.</li></ol>

Using WinAT from the Resource Kit
 On the File menu, click New to display the Add Command dialog box.</li> In the Command box, type c:\zoomserv\bin\Scheduler.bat .</li> <li>Click Today, Tomorrow, Every, or Next.</li> <li>In the Days and Time boxes, click the days and time the command is to run.</li> <li>Click OK.</li></ol>

Using Scheduled Task for Windows 2000
<ol style="list-style-type: lower-alpha;"> <li>Click Start, point to Settings, click Control Panel, and then double-click Scheduled Tasks.</li> <li>Double click Add Scheduled Tasks.</li> <li>Click Next</li> <li>Click Browse, and then locate the batch file that you created earlier in this article (Scheduler.bat).</li> <li>Keep the default name that matches your program name.</li> <li>Select the interval you want. For testing purposes click, One Time Only.</li> <li>Click Next</li> <li>Change the start time to about two minutes ahead of the current time; leave the start date set to the current date.</li> <li>Click Next. You see the screen for the user account that the task will use. Type the user name and password that you are currently logged on with.</li> <li>Click Next.</li> <li>Click Finish.</li></ol>

Windows NT 3.5, 3.51, and 4.0
<ol style="list-style-type: lower-alpha;"> <li>Double-click Control Panel in the Main program group.</li> <li>Double-click Services.</li> <li>Double-click Schedule Service.</li> <li>In the Log On As box, click This Account.</li> <li>Add a user account that has administrative rights to the system.</li> <li>Type the account password and confirm the password.</li> <li>Click OK.</li> <li>To schedule the program to run, type the following line at a command prompt:

at 4:30pm /interactive &quot;c:\zoomserv\bin\scheduler.bat&quot;

NOTE: &quot;4:30pm&quot; is an example. Use a time about two minutes ahead of the current time for this test. When the time expires, the Zoomit service stops and the Scheduler.bat utility runs.</li></ol>

Windows 2000
<ol style="list-style-type: lower-alpha;"> <li>Click Start, point to Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks.</li> <li>Click Advanced, and then click AT Service Account.</li> <li>In the AT Service Account Configuration box, click This Account.</li> <li>Add a user account that has administrative rights to the system.</li> <li>Type the account password and confirm the password.</li> <li>Click OK.</li> <li>To schedule the program to run, type the following line at a command prompt:

at 4:30pm /interactive &quot;c:\zoomserv\bin\scheduler.bat&quot;

NOTE: &quot;4:30pm&quot; is an example. Use a time about two minutes ahead of the current time for this test. When the time expires, the Zoomit service stops and the Scheduler.bat utility runs.</li></ol> </li></ol>

Additional query words: MMS

Keywords: kbhowto kbenv KB281701

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.