Compare-Object

Deep Object Comparisons

Background I was recently asked (at least, that’s what I chose to respond about) how you could do a deep comparison of objects (especially in 2 arrays) in PowerShell. The problem is that most built in ways (Linq, Compare-Object) will only work for objects that are only 2 layers deep. Further layers of depth will just .ToString() and not be counted in the comparison. I encountered a similar situation when I was making a DSC-esque way to manage Discord application commands (which can have MANY layers of objects via options and embeds).