# Manipulating a -size value

**URL:** <https://forums.powershell.org/t/manipulating-a-size-value/20253>\
**Category:** PowerShell Help\
**Created:** [August 24, 2022, 5:29pm UTC](https://forums.powershell.org/t/manipulating-a-size-value/20253 "2022-08-24T17:29:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt1974](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matt1974](https://forums.powershell.org/u/matt1974)\
**Post date:** [August 24, 2022, 5:29pm UTC](https://forums.powershell.org/t/manipulating-a-size-value/20253/1 "2022-08-24T17:29:46Z")

</div>

Hi all,  
Is there an easy way to modify this code so the output makes the Size or Startingoffset easier to read? Like 1GB etc…

`Get-WmiObject win32_diskpartition | Select Systemname, name, size, index, startingoffset`

Thanks!

---

<div class="post-metadata">

**Author:** ![PoshDad](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/poshdad/32/2626_2.png) [@PoshDad](https://forums.powershell.org/u/PoshDad)\
**Post date:** [August 24, 2022, 5:58pm UTC](https://forums.powershell.org/t/manipulating-a-size-value/20253/2 "2022-08-24T17:58:08Z")

</div>

Good morning,

Please use this method when posting code to the forum as it makes it easier for the people working with it.

[Guide to Posting Code - Redux - PowerShell Help - PowerShell Forums](https://forums.powershell.org/t/guide-to-posting-code-redux/15797)

Here is an article I found on your topic  
[Convert bytes to gigabytes with PowerShell – 4sysops](https://4sysops.com/archives/convert-bytes-to-gigabytes-with-powershell/)

I would recommend using Get-Ciminstance as the Get-WMIObject is deprecated.

I put this together, it should give you the expected results.

```auto
Get-Ciminstance win32_diskpartition | Select Name,Index,
@{name="SizeGB";e={[math]::round($_.size /1GB)}},
@{name="OffSetGB";e={[math]::round($_.startingoffset /1GB)}}

```

---

<div class="post-metadata">

**Author:** ![matt1974](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matt1974](https://forums.powershell.org/u/matt1974)\
**Post date:** [August 24, 2022, 6:23pm UTC](https://forums.powershell.org/t/manipulating-a-size-value/20253/3 "2022-08-24T18:23:14Z")

</div>

Thanks for the info, that does it.

---

<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:16pm UTC](https://forums.powershell.org/t/manipulating-a-size-value/20253/4 "2024-05-16T20:16:41Z")

</div>

Closed on May 16, 2024, 8:16pm UTC


