I am using a text file as the backend for an application that I am developing. I first started off leaving the text file in a human-readable format but I decided that there was no sense in that figured it would be best to leave out formatting.

Where I am now in the backend dev process is creating a single-line hashtable with identical keys but different values for each entry. Seems logical and easy to work with.

Here is a mock-up of the entries in the text file:

```
@{'bName'='1xx'; 'bTotal'='1yy'; 'bSet'='1zz'}
@{'bName'='2xx'; 'bTotal'='2yy'; 'bSet'='2zz'}
@{'bName'='3xx'; 'bTotal'='3yy'; 'bSet'='3zz'}

```

As you can see, the keys for each entry are identical, however, the values are going to be different. (*The numerical and repetitious nature of the values are purely coincidental and put in place for the sake of a mock-up. Actual values will not be numerically-oriented and won't be repetitious as seen in the example.*)

I am able to access keys and values by typing:

```
$hash = Get-Content .\Desktop\Test.txt | Out-String | iex

```

which outputs:

```
Name                    Value
----                    -----
bName                   1xx
bTotal                  1yy
bSet                    1zz
bName                   2xx
bTotal                  2yy
bSet                    2zz
bName                   3xx
bTotal                  3yy
bSet                    3zz
```

What I ultimately want to do is gather each of the values for `bName`, `bTotal`, and `bSet` so that I can append each to a separate WinForms ComboBox. The WinForms part will be simple, I am just having a bit of an issue with getting the values from each hashtable in the text file.

I tried:

```
$hash.Values | ?{$hash.Keys -contains 'bName'}

```

but it just prints out every `$hash.Value` regardless of the `$hash.Key` match given in the pipe.

I understand that `$hash` is an array and I figured I may have to pipe out each iteration in a `foreach ($hash | %{})` loop but I'm not quite sure the correct way to do this. For example, when I try:

```
$hash | $_.Keys

```

or

```
$hash | $_.Values

```

it isn't treating each iteration like a hashtable.

What am I doing wrong here? Am I going about it in a convoluted way while there is a much easier way to accomplish this? I am open to all sorts of ideas or suggestions.

---

**As an afterthought**: It is kind of funny how often an obvious solution presents itself when you step away and divert your attention towards something else.

I went to grab lunch and I can't, for the life of me, begin to comprehend why I didn't realize that I could just very easily do this:

```
$hash.bName

```

or:

```
$hash.bTotal

```

or:

```
$hash.bSet

```

That will do exact as I was wanting to do. However, considering the answers provided, I may go a different route in terms of using an .ini file in CSV format rather than creating an array of hashtables.