# Extracting bits from hashtable property

**URL:** <https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782>\
**Category:** PowerShell Help\
**Created:** [June 7, 2018, 10:56am UTC](https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782 "2018-06-07T10:56:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jarek-c](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jarek-c](https://forums.powershell.org/u/jarek-c)\
**Post date:** [June 7, 2018, 10:56am UTC](https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782/1 "2018-06-07T10:56:43Z")

</div>

I have a variable that stores some properties like prop1, prop2, prop3… where a few are in form of hashtables. I’d need to select a couple of the properties stored in the variable and some pieces of the hashtable. The hashtable is in form of e.g. prop2: {@{label1=value1},@{label2=value2},…}  
when I try  
$var | select prop1 -expandproperty prop2  
I’m not getting the output I need. I only want to get value1. What would be the right way to extract the properties out of ?

---

<div class="post-metadata">

**Author:** ![sanchez](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanchez](https://forums.powershell.org/u/sanchez)\
**Post date:** [June 7, 2018, 11:22am UTC](https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782/2 "2018-06-07T11:22:03Z")

</div>

```
$var.item(0)
```

---

<div class="post-metadata">

**Author:** ![jarek-c](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jarek-c](https://forums.powershell.org/u/jarek-c)\
**Post date:** [June 7, 2018, 11:51am UTC](https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782/3 "2018-06-07T11:51:53Z")

</div>

Thanks Jon but in short I get PSCustomObject doesn’t contain method item.

---

<div class="post-metadata">

**Author:** ![sanchez](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanchez](https://forums.powershell.org/u/sanchez)\
**Post date:** [June 7, 2018, 12:08pm UTC](https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782/4 "2018-06-07T12:08:10Z")

</div>

So you don’t have a normal hashtable then.

To be able to help any further, you’ll need to post your code. You can also pipe your data to get-member and look at the information you can access.

---

<div class="post-metadata">

**Author:** ![jarek-c](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jarek-c](https://forums.powershell.org/u/jarek-c)\
**Post date:** [June 7, 2018, 12:31pm UTC](https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782/5 "2018-06-07T12:31:11Z")

</div>

$var is of PSCustomObject type where prop2 is System.Object. The results come from Get-HPiLOHealthSummary commandlet by HPE.  
I managed to get a bit further going  
$vars | select prop1, @{name=“prop2”;expression={[string]::join(“;”,($\_.prop2))}}  
but my prop2 now displays as  
@{label=value};@{label=value}  
how to get rid of @{} then?

---

<div class="post-metadata">

**Author:** ![sanchez](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanchez](https://forums.powershell.org/u/sanchez)\
**Post date:** [June 7, 2018, 12:58pm UTC](https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782/6 "2018-06-07T12:58:28Z")

</div>

[https://social.technet.microsoft.com/Forums/lync/en-US/cbb48b01-242f-44d1-9126-3e0233f5fe8c/expanding-multiple-noteproperties?forum=winserverpowershell](https://social.technet.microsoft.com/Forums/lync/en-US/cbb48b01-242f-44d1-9126-3e0233f5fe8c/expanding-multiple-noteproperties?forum=winserverpowershell)

---

<div class="post-metadata">

**Author:** ![jarek-c](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jarek-c](https://forums.powershell.org/u/jarek-c)\
**Post date:** [June 7, 2018, 1:05pm UTC](https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782/7 "2018-06-07T13:05:44Z")

</div>

Wow! and exact match. Excellent googling skills Jon 🙂 Many thanks

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:34pm UTC](https://forums.powershell.org/t/extracting-bits-from-hashtable-property/10782/8 "2024-05-16T20:34:57Z")

</div>


