Manipulating a -size value

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

Here is an article I found on your topic
Convert bytes to gigabytes with PowerShell – 4sysops

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

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

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