I am attempting to gather the cpu.usage.average for all of our ESX servers. I do want all the time lines it dumps to produce a good report.
If I execute the following code, it dumps out the one server in a table with date time and % however the dates are only Jan 2011 - Apr 2010
Get-Stat -Entity (Get-VMHost myservername.local) -Stat cpu.usage.average
so far so good.
I then made the code below to get it all our servers. However I need it to list the host name on each line. I would also like to dump this to a .csv - should be simple but I am a noob and going through a lot of docs/web sites. This way can sort it in Excel by hostname.
$vhosts = (get-vmhost)
foreach ($vhost in $vhosts)[
Get-Stat -Entity (Get-VMHost $vhost) -Stat cpu.usage.average
}
I assume these values are for a 24 hr period from all cores/sockets
TIA