# Select with object hashtable

**URL:** <https://forums.powershell.org/t/select-with-object-hashtable/13889>\
**Category:** PowerShell Help\
**Created:** [March 1, 2020, 2:08pm UTC](https://forums.powershell.org/t/select-with-object-hashtable/13889 "2020-03-01T14:08:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maro-k](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@maro-k](https://forums.powershell.org/u/maro-k)\
**Post date:** [March 1, 2020, 2:08pm UTC](https://forums.powershell.org/t/select-with-object-hashtable/13889/1 "2020-03-01T14:08:57Z")

</div>

Hello All,

My script $vm = get-vm | ft Name, numcpu, memorygb, @{N=“Hard Disk”; E={get-harddisk -VM $\_ |  
`select -ExpandProperty CapacityGB }} , @{N=“IP Address”;E={@($\_.guest.IPAddress[0])}} -AutoSize

Give me all vms with hdd sizes of them. But if any vm have more than a few disks results looks like

{100, 1536, 1224, 1024…}

What should I change in script to show all available disk ?

Is it possible to show disks without brackets { } ?

&nbsp;

Regards

Marek

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![js2010](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@js2010](https://forums.powershell.org/u/js2010)\
**Post date:** [March 1, 2020, 2:27pm UTC](https://forums.powershell.org/t/select-with-object-hashtable/13889/2 "2020-03-01T14:27:11Z")

</div>

Put format-table last. It turns everything into format objects for screen text output.

```
[pscustomobject]@{name='joe'} | format-table | % gettype 

IsPublic IsSerial Name BaseType
-------- -------- ---- --------
False False FormatStartData Microsoft.PowerShell.Commands.Internal.Format.StartData
False False GroupStartData Microsoft.PowerShell.Commands.Internal.Format.StartData
False False FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.PacketInfoData
False False GroupEndData Microsoft.PowerShell.Commands.Internal.Format.ControlInfoData
False False FormatEndData Microsoft.PowerShell.Commands.Internal.Format.ControlInfoData
```

---

<div class="post-metadata">

**Author:** ![maro-k](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@maro-k](https://forums.powershell.org/u/maro-k)\
**Post date:** [March 1, 2020, 3:05pm UTC](https://forums.powershell.org/t/select-with-object-hashtable/13889/3 "2020-03-01T15:05:07Z")

</div>

I don’t understand. Added here

get-vm | ft Name, numcpu, memorygb, @{N=“Hard Disk”; E={get-harddisk -VM $\_ |

```auto
select -ExpandProperty CapacityGB <strong>| FT</strong> }} , @{N="IP Address";E={@($_.guest.IPAddress[0])}}

but instand of hdd size it shows type "{Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData.."
I also checked FT in last section
get-vm | ft Name, numcpu, memorygb, @{N="Hard Disk"; E={get-harddisk -VM $_ |

```

select -ExpandProperty CapacityGB }} , @{N=“IP Address”;E={@($\_.guest.IPAddress[0])}} **| FT**

but results is still {100, 1536, 1224, 1024…}

&nbsp;

---

<div class="post-metadata">

**Author:** ![js2010](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@js2010](https://forums.powershell.org/u/js2010)\
**Post date:** [March 1, 2020, 3:53pm UTC](https://forums.powershell.org/t/select-with-object-hashtable/13889/4 "2020-03-01T15:53:05Z")

</div>

I don’t understand your code. It’s is convoluted. Please format it with the pre tags and include the output. I don’t have the get-vm command, so I’m also at a disadvantage. Maybe you can turn the array into a string like this.

```
(1,2,3) -join ', '

1, 2, 3
```

---

<div class="post-metadata">

**Author:** ![sam-boutros](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/sam-boutros/32/5_2.png) [@sam-boutros](https://forums.powershell.org/u/sam-boutros)\
**Post date:** [March 1, 2020, 3:56pm UTC](https://forums.powershell.org/t/select-with-object-hashtable/13889/5 "2020-03-01T15:56:45Z")

</div>

```
$vm = get-vm | 
    ft Name, numcpu, memorygb, 
        @{N=”Hard Disk”; E={ (get-harddisk -VM $_ | select -ExpandProperty CapacityGB) -join ',' }} , 
        @{N=”IP Address”;E={ $_.guest.IPAddress[0] }} -AutoSize
```

---

<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:30pm UTC](https://forums.powershell.org/t/select-with-object-hashtable/13889/6 "2024-05-16T20:30:23Z")

</div>


