Share via


FIM 2010: How to prepare Management Agent Run Profile Script to be used in Scheduled Task

When you create a FIM Run Profile, you can easily generate a script that can execute its tasks. This could be done by clicking on Script button after selecting your Management Agent Run Profile.

A VBS script will be generated and, if you run it manually, it will start the Run Profile and will display the progress status.

This script need to be slightly modified to be included in a Scheduled Task. In fact, you need to remove displaying the progress status messages from the script as, if this is not done, the scheduled task will remain in running state when launched without running the management agent Run Profile.

Below is an example of a Run Profile script:

Const PktPrivacy = 6

rem Const wbemAuthenticationLevelPkt = 6

Set Locator = CreateObject("WbemScripting.SWbemLocator")

rem

rem Credentials must only be specified when Microsoft Identity Integration Server is on remote system.

rem

rem Locator.Security_.AuthenticationLevel = wbemAuthenticationLevelPkt

rem Set Service = Locator.ConnectServer("MyServer", "root/MicrosoftIdentityIntegrationServer")

rem Set Service = Locator.ConnectServer("MyServer", "root/MicrosoftIdentityIntegrationServer", "Domain\Me", "MyPassword")

rem

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

Set MASet   = Service.ExecQuery("select * from MIIS_ManagementAgent where Guid = '{F294338F-86F2-41A7-98FF-E107A6477CDD}'")

for each MA in MASet

    WScript.Echo "Running " + MA.name + ".Execute(""Active Directory Connector Full Cycle"")..."

    WScript.Echo "Run completed with result: " + MA.Execute("Active Directory Connector Full Cycle")

next

By removing the echo messages shown in Red, you will keep only the execution of Run Profile tasks and you will be able to schedule the script using Task Scheduled. This is all what you need to create scheduled tasks for Run Profiles.

Back to Top