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

'FIMCycle.vbs'

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
ClearRuns(1)
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..."
  WScript.Sleep(Seconds*1000)
End Sub

Sub Run(MASet, Profile)
  For Each MA In MASet
    WScript.Echo "Running " + MA.name + ".Execute('" & Profile & "')..."
    WScript.Echo "Run completed with result: " + MA.Execute(Profile)
  Next
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

5 comments:

  1. Check out http://www.traxionsolutions.com/imsequencer

    It runs on 64 bit

    ReplyDelete
  2. 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.

    ReplyDelete
  3. @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.

    ReplyDelete
  4. 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.

    http://www.unifysolutions.net

    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

    ReplyDelete