Although you can run a management agent from Synchronization Service Manager, with the Windows Management Instrumentation (WMI) Provider, you can also run a management agent from a script.

The advantages of running a management agent from a script:

The following Microsoft Visual Basic Scripting Edition (VBScript) example shows how to create a script that runs a management agent with a specified run profile. The script runs the Fabrikam HR MA management agent with a full import run profile and then returns a value. You can use this return value to determine if you can run other scripts.

Visual Basic Script  Copy Code
Option Explicit

On Error Resume Next

Const PktPrivacy = 6 ' Authentication Level

Dim Service		' Connection object

Dim ManagementAgent  ' Management agent object

Dim Status		 ' String for the status

Dim ErrorLevel	 ' Return code

ErrorLevel = 1

Set Service = GetObject("winmgmts:{authenticationLevel=PktPrivacy}!root\MicrosoftIdentityIntegrationServer")

Set ManagementAgent = Service.Get("MIIS_ManagementAgent.Name='Fabrikam HR MA'")

Status = ManagementAgent.Execute("Full Import")

If Status = "success" then

   ErrorLevel = 0

End if

WScript.Echo "Management Agent Run Result: " & Status

Sub ErrorHandler (ErrorMessage)
  WScript.Echo ErrorMessage
  WScript.Quit(1)
End Sub

See Also

[an error occurred while processing this directive]