VMware Cloud Community
jgalexander99
Contributor
Contributor
Jump to solution

How do I show the ESX host name along with the hardware info (see script)

I would like to see the ESX host name in the first column.

Is there a better way to do this?

Any help is much appreciated.  Thanks,

The section of my script for hardware looks like this:

#######################
# VMware ESX hardware #
#######################
Get-VMHost | Get-View | ForEach-Object { $_.Summary.Hardware } | Select-object Name, Vendor, Model, MemorySize, CpuModel, CpuMhz, NumCpuPkgs, NumCpuCores, NumCpuThreads, NumNics, NumHBAs | ConvertTo-Html -title "VMware ESX server Hardware configuration" -body "<H2>VMware ESX server Hardware configuration.</H2>" | Out-File -Append $filelocation

And My Out put currently looks like this:

(I want to see the ESX Host server name as the first column)

VMware ESX server Hardware configuration.

VendorModelMemorySizeCpuModelCpuMhzNumCpuPkgsNumCpuCoresNumCpuThreadsNumNicsNumHBAs
HPProLiant DL360 G734348974080Intel(R) Xeon(R) CPU E5640 @ 2.67GHz2666281643
HPProLiant DL360 G734348974080Intel(R) Xeon(R) CPU E5640 @ 2.67GHz2666281643
HPProLiant BL460c G625758969856Intel(R) Xeon(R) CPU E5540 @ 2.53GHz253314883
HPProLiant BL460c G625758969856Intel(R) Xeon(R) CPU X5570 @ 2.93GHz293314883
HPProLiant BL490c G7137428156416Intel(R) Xeon(R) CPU X5675 @ 3.07GHz30662122442
HPProLiant BL490c G7137428156416Intel(R) Xeon(R) CPU X5675 @ 3.07GHz30662122442
HPProLiant BL490c G7137428156416Intel(R) Xeon(R) CPU X5675 @ 3.07GHz30662122442
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Not the most elegant solution but it should produce the desired result

&{foreach ($esx in Get-VMHost){
  ForEach-Object { $esx.ExtensionData.Summary.Hardware } | 
  Select-object @{N="ESX Name";E={$esx.Name}},Vendor, Model, MemorySize, CpuModel, CpuMhz, NumCpuPkgs, NumCpuCores, NumCpuThreads, NumNics, NumHBAs}} |
ConvertTo-Html -title "VMware ESX server Hardware configuration" -body "<H2>VMware ESX server Hardware configuration.</H2>" | Out-File -Append $filelocation


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Not the most elegant solution but it should produce the desired result

&{foreach ($esx in Get-VMHost){
  ForEach-Object { $esx.ExtensionData.Summary.Hardware } | 
  Select-object @{N="ESX Name";E={$esx.Name}},Vendor, Model, MemorySize, CpuModel, CpuMhz, NumCpuPkgs, NumCpuCores, NumCpuThreads, NumNics, NumHBAs}} |
ConvertTo-Html -title "VMware ESX server Hardware configuration" -body "<H2>VMware ESX server Hardware configuration.</H2>" | Out-File -Append $filelocation


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jgalexander99
Contributor
Contributor
Jump to solution

Great, That does it.

thanks,

James Alexander

Team Lead

Enterprise Windows and Storage

10 Glenlake Parkway, Suite 800

Atlanta, GA, 30328

Direct Number: 678-387-4704

0 Kudos