I have two arrays of custom objects - $deploy and $directory. They have 4 properties in common and 1 property that is unique to each. I need to find the members of both arrays where the 4 common properties are the same, but i need to track the 2 unique properties for the matches as well.
Using compare-object on the two arrays with the defined same properties, -passthru and -includeequal is almost it, but only gives me the first (reference) object with its unique property, not the unique property on the difference object.
So I can't simply compare the two arrays and get what I need. I either need to do a nested loop, or hack up/find some sort of "set intersection" function. I'm only going to be dealing with a few dozen members of each array so I'm not too concerned about performance.
What approach would you take? For the simple example below, I would want both the environmentname and deploymentdirectory tracked for all matches.
$deploy
GameBuildVersion : 68858.zip
OnlineVersion : 70793.zip
ContentVersion : 68858.69165-1.zip
ContentBuildVersion : 69165-1.zip
environmentname : Staging35
$directory
GameBuildVersion : 68858.zip
OnlineVersion : 70793.zip
ContentVersion : 68858.69165-1.zip
ContentBuildVersion : 69165-1.zip
deploymentDirectory : C:\deployer\script\deploy-AB