I want to have all objects of array1 that are not part of array2
Im using this::
$array3 = $array1 | Where {$array2.ObjectID -NotContains $_.ObjectID}
This is almost working except for one issue:
This also adds objects of array2 that are not an object of array1 to array3, but this is NOT what i want. I want only to add objects of array 1 if they are not an object within array2
And BTW: When you post code please format it as code using the preformatted text button ( </> ). Simply place your curseor on an empty line, click the button and paste your code.
The example you show would not do what you state. No members of $array2 will end up in $array3. Assuming the object has property ObjectID, it should do exactly what you desire.