1

I am trying to store the results of a Compare-Object for later use.

When i store it in a variable, it comes up blank.

I reviewed the MSDN article on Compare-Object and it states no output is generated.

Any ideas on how to do this?

1
  • Without showing us your code we can only guess ... Commented Jun 13, 2011 at 21:20

2 Answers 2

4

You can store the results of a comparsion like this:

$result = Compare-Object $object1 $object2

If you aren't getting anything put into $result, then the two objects are identical.

Sign up to request clarification or add additional context in comments.

Comments

1

You can do:

$result = Compare-Object $a $b

$result will be empty when there is no difference. ( for example $result = Compare-Object $a $a ) . You can do something like if($result) to see if there is a difference and proceed accordingly.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.