Thursday, September 04, 2014

What Requests Touched my FIM Object

Changes to objects in FIM usually happen when a Request is processed.  Here is a quick query to find recent Request objects that touched a given FIM object:



### Find Requests that touched a certain object with a specific time


Export-FimConfig -Only -Custom "Request[Target = /ManagementPolicyRule[DisplayName='HoofHearted'] and CreatedTime >= '$([DateTime]::UtcNow.AddMinutes(-5).ToString("s"))']" |

Convert-FimExportToPSObject |

Select-Object -Last 1 |

Get-FimRequestParameter |

Format-Table Mode, PropertyName, Value -AutoSize


There are only a few tricks in this snippet:

  • Using the “s” format string to get a DateTime string compatible with the XPath query for FIM
  • Using [DateTime]::UtcNow to get a DateTime in the same ‘kind’ as FIM
  • Using Get-FimRequestParameter to parse the FIM Request details into sometime easier to work with

I have been using this lately to validate that the code I’m working on is producing the expected changes in the FIM Requests it is making.

It’d be so nice if FIM would tell you the ObjectID of the Request it creates after you submit the operation to the FIM web services.

No comments: