Thursday, March 04, 2010

RunHistory Parsing

In writing some scripts to dig out Sync errors lately I ran into a strange bug.  On the plus side, I wasn’t able to repro on FIM, just on ILM.


Running this command will eventually start to return null:

Get-WmiObject -Class MIIS_RunHistory -Namespace root/MicrosoftIdentityIntegrationServer -filter("MaName='MyMA'")

This is strange because the query doesn’t change, but eventually it will just stop working.  The cmdlet doesn’t report an error, it just stops returning results.  Once this happens the only way I am able to fix it is to restart the ‘Windows Management Infrastructure’ service.


Cycling the WMI service is a bit of a pain, so instead I issue the query using the MaGUID:

$ma = Get-WmiObject -Class MIIS_ManagementAgent -Namespace root/MicrosoftIdentityIntegrationServer -Filter("Name='MyMA'")
Get-WmiObject -Class MIIS_RunHistory -Namespace root/MicrosoftIdentityIntegrationServer -filter("MaGuid='" + $ma.guid + "'")

Issuing the query using the MA Guid did not repro the problem.  A simple little workaround to a strange little problem.

1 comment:

Peter Lambrechtsen said...

Try using MaGuid as part of the filter 18 times. The filter stops working after 17 queries.