1. How did you get your code so show up formated and color coded?
2. Thanks for the code. I found some code that is similar and it works for what I need. I was wondering if you could explain how the lines starting "Group-Object" through "New Object" work or guide me to some documentation that could explain those concepts.
$entity = Get-Cluster -Name IaaS-D |
$start = (Get-Date).AddMonths(-1)
$counter = "cpu.usage.average"
Get-Stat -Entity $entity -Stat $counter -Start $start |
Group-Object -Property {$_.Entity.Name} | %{
$stats = $_.Group | Measure-Object -Property Value -Average -Maximum -Minimum
New-Object PSObject -Property @{
Cluster = $_.Name
CPUAvg = [math]::round(($stats.Average), 0)
CPUMin = [math]::round(($stats.Minimum), 0)
CPUMax = [math]::round(($stats.Maximum), 0)
}
}