Wednesday, January 12, 2011

Using the Compare-Object Cmdlet

Just a short post on this cmdlet: Compare-Object.

I've found it incredibly useful in a lot of my scripts where I'm diff'ing FIM configurations, but sometimes the results just didn't seem right, which made me lose confidence in the cmdlet until I found this post at PowerShell.com:
Tipps & Tricks Using Compare-Object

Before I read that post I was resorting to boiling my objects down to simple String arrays, which seemed to make the results better.  Thanks to that post I can now compare arrays of objects again, which is a lot simpler in scripts, and a LOT more powerful.

Just today I used it to compare the IAF and EAF rules on a FIM Sync box where each config had ~300 rules.  In seconds the Compare-Object cmdlet was able to tell me that only 30 rules were different between the two configs, and what the specific differences were.

COOL!

No comments: