FIM provides a Windows Management Interface (WMI) namespace for working with the synchronization service. This is root\MicrosoftIdentityIntegrationServer, and contains a couple of classes. One of them is MIIS_SERVER. This can be used to clear runs. This must be run as a user with either membership in the FIMAdmins or the FIMSyncOperators group.
# Get the MIIS_SERVER class $lstSrv = @(get-wmiobject -class "MIIS_SERVER" -namespace "root\MicrosoftIdentityIntegrationServer" -computer ".") # Clear runs older than 3 days $date = (get-date).addDays(-3) # Create string in correct format (yyyy-MM-ddTH:m:s.000) $datestr = $date.year.ToString()+"-"+$date.month.ToString().PadLeft(2,"0")+"-"+$date.day.ToString().PadLeft(2,"0")+"T"+$date.hour.ToString().PadLeft(2,"0")+":00:00.000" # Run the query $lstSrv[0].ClearRuns($datestr)