Saturday, March 6, 2010

Scheduling FIM 2010 without MASequencer

UPDATE: Check out the MARunScheduler for FIM (get it here)

I don't know about you, but I've been unable to find an MASequencer for 64-bit. Therefore, for now, I've decided to use VBScript for scheduling my Synchronization Service runs. I've made a little "framework" below.

Remember to replace the guid's within the WMI select statements with your own MA guid's


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

Set FIM = Service.ExecQuery("select * from MIIS_ManagementAgent where Guid = '{2B299011-65BA-4DD5-9A59-9BAF8A5C5332}'")
Set AD = Service.ExecQuery("select * from MIIS_ManagementAgent where Guid = '{B906936E-742D-4551-8C07-2FE4B72C4795}'")
Set HR = Service.ExecQuery("select * from MIIS_ManagementAgent where Guid = '{9CA3F96C-300A-4EFB-8246-89EDBC4047E5}'")

' main processing
Run HR, "Full Import and Full Sync"
Run FIM, "Delta Import and Delta Sync"
Run AD, "Delta Import and Delta Sync"

Run FIM, "Export"

'allow for FIM to do some processing
Wait 5

Run FIM, "Delta Import and Delta Sync"
Run HR, "Export"
Run AD, "Export"

Sub Wait(Seconds)
  WScript.Echo "Waiting " & Seconds & " seconds..."
End Sub

Sub Run(MASet, Profile)
  For Each MA In MASet
    WScript.Echo "Running " + + ".Execute('" & Profile & "')..."
    WScript.Echo "Run completed with result: " + MA.Execute(Profile)
End Sub
Sub ClearRuns(DaysAgo)

  Set Server = Service.Get("MIIS_Server.Name='localhost'")
  DeleteDate = FormatDateTime(Now()-DaysAgo, 2)
  WScript.Echo "Deleting Run Histories from " & DeleteDate
  WScript.Echo "Result: " & Server.ClearRuns(DeleteDate)
End Sub


Anonymous said...

Check out

It runs on 64 bit

Per Østergaard said...

The downside to this approach is that is uses a GUID to lookup the MA - not the name. Ths means that the "disable MA work-around" method of renaming the MA to avoid it being executed by scheduled tasks, cannot be used.
Use name= in the Service.ExecQuery statements to use the name as an alternative to the GUID.

Søren Granfeldt said...

@Per: I agree´and I've already implemented the name version instead the guid version at some customers. Using the guid version could however make sure that the script does run any "rogue" MA's if you need that kind of security.

Ross Currie said...

I'd throw in my 2 cents here that UNIFY Event Broker also allows you to schedule and run MA operations in a 64-bit environment.

In addition to automation, it has the ability to run MA operations only when required (exports when exports pending, imports when the source has new data) and allows you to individually disable incoming/outgoing operations on MA's

Søren Granfeldt said...

Update: Check out the MARunScheduler