I have this PS script that gives me back the top 5 processes consuming the most virt memory. I'd like to display the MB with not so many numbers to the right of the decimal point.
Scripts
*****
#Top 5 PROCESSES CONSUMING THE MOST VIRT MEMORY
write-host `n "Top 5 PROCESSES CONSUMING THE MOST VIRT MEMORY (MB)" -BackgroundColor Blue -ForegroundColor White
Get-Process -ComputerName $Server |Select Name,@{n="VM";e={$_.VM /1MB}} | Sort-Object VM -Descending | Select-Object Name, VM -First 5 | Format-Table –AutoSize
Output
******
Top 5 PROCESSES CONSUMING THE MOST VIRT MEMORY (MB)
Name VM
---- --
ThermalController 770.83203125
svchost 744.21875
mbamservice 603.19140625
AWCCServiceController 599.30078125
powershell 582.765625
Desired Output
************
Top 5 PROCESSES CONSUMING THE MOST VIRT MEMORY (MB)
Name VM
---- --
ThermalController 770.83
svchost 744.21
mbamservice 603.19
AWCCServiceController 599.30
powershell 582.76
I know that there's a way to format the numbers via this method: http://technet.microsoft.com/en-us/library/ee692795.aspx
but I don't know how to plug it in the script properly without generating an error.