Working with FIM Exports

We’ve all been there – you run one little export-fimconfig cmdlet and next thing you know you’ve got a ton of data to process – and given the number of cross links between the different FIM objects you know it’s just not going to be pretty.

In an attempt to make it a little easier for myself, I’m currently experimenting with some PowerShell that converts the results from the Export cmdlet into a hashtable so I can access it more easily – rather than trying to navigate my way through the ResourceManagementAttributes collection, it’s much easier to just go directly to the named property I’m looking for:

becomes the far more palettable:

So – what’s the secret to this? it’s a simple block of code that iterates all of the available fim objects and converts them into a collection of hashtables (using the ObjectID as the master key so we can then lookup objects when we’re following references)

The script I’m playing with looks along the lines of:

Essentially all this does is iterate through every object that is passed into it, and for this object retrieve all of the attribute-value pairs it contains. This is then loaded into a hashtable, which is then stored using the ObjectID as a master key.

This version is extended slightly to have additional lists of object types, bindings and attributes for an experimental “FIM schema to HTML” convertor I’m playing with – but at it’s heart it’s fairly simple.

Once it’s processed the objects to read in, then it’s relatively simple to either look up a reference or work with objects just by stepping through them and checking the attributes quickly and cleanly.

for example, the following code writes to a file ($ofile) a table for each attribute – but will attempt to use a DisplayName for a linked object rather than the unique identifier (not that they’re easier to read or anything!) – the key snippet that retrieves the displayname from a reference is as simple as: $all[$id][“DisplayName”]

I’ve uploaded the schema writer as well – it is very experimental but may prove useful to someone out there!.

Htmlschema.ps1
Htmlschema.ps1
htmlschema.ps1
4.7 KiB
563 Downloads
Details...
This entry was posted in FIM, Powershell, Snippets, Tools and tagged , , , , , . Bookmark the permalink.

Leave a Reply

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