Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

comparing HashTables

$
0
0

I am trying to get the difference between two Hash Tables.

Example:

Start off with a Blank table..

$Hash1  = @{}

$Hash2   = @{}

Foreach Statement....

$Hash1.add($field_1,$field_2)

Foreach Statement....

$Hash2.add($field_1,$field_2)

Data..

$Hash1

Name,  Value

Test1, 123

Test2, 456

Test3, 789

$Hash2

Name,  Value

Test1, 123

Test2, 456

Test4, 012

What I am trying to figure out,   how do I get the difference between the two.    My results should be  Test4, 012

I thought there was a oneliner for Compare-Object that would work

Thank you


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>