I need to collect CPUinfo from the hosts
Get-VMHost | Sort Name | Get-View | Select Name,
@{N=“CPU“;E={$_.Hardware.CpuPkg[0].Description}},
@{N=“CPUSockets“;E={$_.Hardware.CpuInfo.NumCpuPackages}},
@{N=“SUMcores“;E={$_.Hardware.CpuInfo.NumCpuCores}}
Additionally i like to retrieve "Cores per Socket" as in vCenter Host summary
Like this
Get-VMHost | Sort Name | Get-View |
Select Name, @{N=“CPU“;E={$_.Hardware.CpuPkg[0].Description}},
@{N=“CPUSockets“;E={$_.Hardware.CpuInfo.NumCpuPackages}},
@{N=“SUMcores“;E={$_.Hardware.CpuInfo.NumCpuCores}},
@{N=“Cores/socket“;E={$_.Hardware.CpuInfo.NumCpuCores/$_.Hardware.CpuInfo.NumCpuPackages}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm not aware of a Cores/CPU property.
I suspect the vSphere client gets the value in a similar way.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ok Thanks a lot Lucd !
regards
Fred
Hi LuCD,
How to retrieve MemoryTotal MB as in vCenter Host summary?
I have below script, but not able to list the Memory.
$HostReport = @()
Get-Cluster "NJMQA_Cluster01" |
Get-VMHost |Get-View |%{
$Report = "" | select Hostname, version, Build, manufacture, Model,cpu_model, core_num, ip_address,vmotion_ip, HBA_num, P_nic, Memory
$Report.Hostname = $_.Name
$Report.version =$_.Config.Product.Version
$Report.Build =$_.Config.Product.Build
$Report.manufacture =$_.Hardware.SystemInfo.Vendor
$Report.Model =$_.Hardware.SystemInfo.Model
$Report.cpu_model =$_.Summary.Hardware.CpuModel
$Report.core_num =$_.Hardware.CpuInfo.NumCpuCores
if($Report.version -like "3.5.*"){
$Report.ip_address =$_.Config.Network.ConsoleVnic.Spec.ip.ipaddress
}
else {$Report.ip_address =$_.Config.Network.ConsoleVnic[0].Spec.ip.ipaddress}
$Report.vmotion_ip =$_.Config.Vmotion.IpConfig.IpAddress
$Report.HBA_num =$_.Summary.Hardware.NumHBAs
$Report.P_nic =$_.Config.Network.Pnic.count
$Report.Memory =$_.summary.Hardware.MemoryTotalMB
$HostReport += $Report
}
$HostReport | Export-Csv "C:\NJM\HostReport111.csv" –NoTypeInformation