FIM – Clear runs from PowerShell

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")+"-"+$,"0")+"T"+$date.hour.ToString().PadLeft(2,"0")+":00:00.000"
# Run the query

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s