Microsoft Identity Integration Server 2003 Developer Reference |
While you can run a management agent from Identity Manager, the WMI Provider enables you to also run a management agent from a script. The advantages of running a management agent from a script are:
The following 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.
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
Example: Specifying Management Agents From a Command Line, Example: Running Several Management Agents from a Command File, Enabling Security in Scripts