Schedule FIM 2010 with a sleep option

When scheduling your run profiles in FIM 2010 you sometimes needs to add a short sleep, to allow for the external system to process data. This can for example be required when the FIM Service needs to apply some workflow on the exported data before you import the result.

In this post I will show you one option to do so when using PowerShell script to run the profiles in FIM Synchronization Service.

The scripts I show you snippets of in this post can be downloaded here: ScheduleFIMwSleep.

DeltaRunWithSleep.ps1

I usually use a PowerShell script to schedule the typical run profiles.
In the script I allow for a special “profile” using the syntax “Sleep:X” to make the script sleep for X seconds.

@{
name="FIMService";
profilesToRun=@("Export";"Sleep:30";"Delta Import";"Delta Sync");
};

So whenever it finds this “Sleep” profile it will sleep instead of trying to run an actual run profile.

if($profileName.StartsWith("Sleep"))
{Start-Sleep -Seconds $profileName.Split(":")[1]}
else
{
$result = $MA.Execute($profileName);
if("success".Equals($result.ReturnValue)){} else {$msg = "Error: "+$result}
}

ReloadWithSleep.ps1

A special case of run schedule is when you need to do some kind of reload or initial load of data. This could be just because you deleted a connector space and need to reload or when changing configuration.
If you use this due to migrating or changing configuration you should be aware that you should always run Full Synchronization rather than Delta on all MA’s with configuration changes.
In this run profile I have added that it disables provisioning before running any run profiles and then enables it once it’s done.

#Disable Provisioning
& "$scriptpath/DisableProvisioning.ps1"

#Run Profiles
do {….}

#EnableProvisioning
& "$scriptpath/EnableProvisioning.ps1"

As you can see the actual enabling and disabling is made in two separate PowerShell scripts (EnableProvisioning.ps1 and DisableProvisioning.ps1) that need to reside in the same folder as the script calling.

Hopefully the information in this post makes your scheduling of FIM 2010 easier.

One Reply to “Schedule FIM 2010 with a sleep option”

  1. Pingback: FIM 2010: Event driven scheduling | Wim Beck

Leave a Reply

Your email address will not be published. Required fields are marked *