I am wanting to get an output of the average cpu usage for all of our servers. I am using the following code however I would like each line to also list the host that it came from. Right now it just outputs the date/time/% I would like to output this to a CSV so I can import in Excel and sort by hostname.
Any help would be much appreciated as I am pretty new to this and still looking through a lot of web sites and examples. (http://www.lucd.info/2009/12/30/powercli-vsphere-statistics-part-1-the-basics/)
$vhosts - (get-vmhost)
foreach ($vhost in $vhosts){
Get-Stat -Entity (Get-VMHost $vhost) -Stat cpu.usage.average
}
Thanks in advance.