This content has been marked as final.
Show 3 replies
-
1. Re: sum the value in the colume
kwhornlcs Jun 15, 2018 6:14 AM (in response to VirtualRay)This should get you started:
$datastores = Get-DataStore|Where {$_.Name -like "XIO*"} $sumFree = ($datastores| Measure-Object -Property FreeSpaceGB -Sum).Sum $sumCap = ($datastores| Measure-Object -Property CapacityGB -Sum).Sum $pctFree = [math]::Round(($SumFree/$sumCap)*100,2)
-
2. Re: sum the value in the colume
VirtualRay Jun 15, 2018 7:59 AM (in response to kwhornlcs)thank you very much. i am new to programming.
$pctFree = [math]::Round(($SumFree/$sumCap)*100,2)
what is the purpose of ,2 ?
-
3. Re: sum the value in the colume
kwhornlcs Jun 15, 2018 6:56 PM (in response to VirtualRay)1 person found this helpfulThat's how many decimal places the that the resulting percent will be rounded to.
In this case I rounded to two decimal places.