Reputation: 5
I have this script line:
Get-WmiObject Win32_ComputerSystem | Select-Object TotalPhysicalMemory, @{Name="GB";Expression={$_.TotalPhysicalMemory/1GB}}
How to round this result 2 separate places after coma. result at the moment is enter image description here
Upvotes: 0
Views: 847
Reputation: 8868
You can use the format string operator and specify the number of decimal places like this
Get-WmiObject Win32_ComputerSystem |
Select-Object TotalPhysicalMemory,
@{Name="GB";Expression={"{0:n2}" -f ($_.TotalPhysicalMemory/1GB)}}
Upvotes: 2