Hi,
I am trying to use round function in my script. Objective of script is calculate avg CPU an avg Mem at Folder level. I want after decimal, it should print upto level two (10.52) like that.
Its not working
$stats1 = Get-Stat -Entity $FolderVMs -Stat "mem.usage.average" -Start $todayMidnight.AddDays(-15) -Finish $todayMidnight.AddDays(-1) -ErrorAction SilentlyContinue | Where-Object {
$workingDays -contains $_.Timestamp.DayOfWeek -and$_.Timestamp.TimeOfDay -gt $dayStart.TimeOfDay -and $_.Timestamp.TimeOfDay -lt $dayEnd.TimeOfDay }
$TempObject.MemAvg = [math]::round((($stats1 | Measure-Object -Property value -Average) ,2).AVERAGE)
-A
The parenthesis are not correct, try like this
$TempObject.MemAvg = [math]::round(($stats1 | Measure-Object -Property value -Average | Select -ExpandProperty Average),2)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The parenthesis are not correct, try like this
$TempObject.MemAvg = [math]::round(($stats1 | Measure-Object -Property value -Average | Select -ExpandProperty Average),2)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD.. It solves the purpose