I am trying to compare two objects in PS.
$object1 = "1.1.1.1,2.2.2.2,3.3.3.3" $object2 = "3.3.3.3,4.4.4.4"
How do I compare these two objects and include similarities into a new variable?
I've tried -
$compare = Compare-Object -IncludeEqual $object1 $object2 | Select -ExpandProperty InputObject
But no luck with the whole Compare-Object cmdlet.
I would split the two objects into two String arrays and compare their content.
Here an example:
In the res variable you will find 3.3.3.3.
I hope that could help you in some way.