In the following code, why does it return the results as an integer. Shouldn't it be showing me the full number such as 323.23456324324 which I should then be able to [math]::round(stuffhere,2)?
Get-WmiObject -class Win32_LogicalDisk | ForEach-Object {$_.Size = $_.Size/1GB; $_} | ForEach-Object {$_.FreeSpace = $_.FreeSpace/1GB; $_} | FT DeviceID,Size
If I do it into a regular foreach ($x in $variable {, it ends up working as I want so I can round it to the hundreth.
I guess the best way to do it anyways is:
Get-WmiObject -class Win32_LogicalDisk | Format-Table DeviceID,@{Label="Size";Expression={[math]::round($_.FreeSpace/1GB,2)}}
But still, I am curious as to why the first line doesn't work.