I must be missing something. i have to variables: $var1 and $var2
$var1 | gm
TypeName: System.Collections.Hashtable
Each of them has IP and Por
When you use parentheses, PowerShell constructs an array with all the values in it, and uses that as the value for one parameter.
So, CompareData ($var1, $var2)
is equivalent to CompareData -data1 @($var1, $var2)
with no value specified for the -data2
parameter.
If you use CompareData -data1 $var1 -data2 $var2
as suggested by @dwillits you should get the result you expect.