Hi,
I am running the below script but want to modify it so that I can add the Maximum CPU available and % CPU used statistics into the table by way of a calculation, I am just struggling to get the syntax right as you will see highlighted below.
I would really appreciate some help.
Thanks,
Dan
$Report = @()
$ESXHosts = Get-VMHost | Sort Name | Get-View
ForEach ($ESXHost in $ESXHosts)
{
$ReportObj = "" | Select Name, "VMotion Enabled", "Connection State", "Overall CPU", "Max CPU", "% CPU Used"
$ReportObj.Name = $ESXHost.Name
$ReportObj."VMotion Enabled" = $ESXHost.summary.config.vmotionenabled
$ReportObj."Connection State" = $ESXHost.summary.runtime.connectionstate
$ReportObj."Overall CPU" = $ESXHost.summary.quickStats.overallCpuUsage
$ReportObj."Max CPU" = *(($ESXHost.summary.NumCpuCores*$ESXHost.summary.NumCpuPkgs*$ESXHost.summary.CpuMhz))*
$ReportObj."% CPU Used" = *(($ESXHost.summary.quickStats.overallCpuUsage)/(($ESXHost.summary.NumCpuCores*$ESXHost.summary.NumCpuPkgs*$ESXHost.summary.CpuMhz)))*
$Report += $ReportObj
}
$Report | ConvertTo-Html -title "Advanced Host Information" -body "<H4>Advanced Host Information</H4>" | Out-File -Append $filelocation
Tags:
automation,
get-view,
get-vmhost,
powercli,
powershell,
report,
reporting,
script,
vmware,
hardware,
summary,
quickstats