OK great thanks. This report works as I run it but inputting a VM or set of VMs and report on this one metric for the set of VMs. In my case 'm trying to actually run this report in such a way that I am listing a set of VMs, then for each VM caclulating a certain set of properties, in which this is one.
For example:
$stat = "cpu.usagemhz.average"
$start = (Get-Date).AddDays(-30)
get-vm myvm | select name, numcpu,
@{N="Average CPU Usage";E={
Get-Stat -Entity $_ -Stat $statCPUMHzAvg -Start $start |
Group-Object -Property {$_.Entity.Name} | %{
$calc = $_.Group | Measure-Object -Property Value -Average
New-Object PSObject -Property @{
AvgCPUMhz = [Math]::Round($calc.Average)
}
} | Select AvgCPUMhz
}}
1. Is it possible to modify the report to do this?
Also, The output of the report is
@{AvgCPUMHz=150}
instead of just
150
2. How can I remove the @{} from the output?
Thanks!