VMware Cloud Community
antoniogemelli
Hot Shot
Hot Shot

Get Hardware info

Hello,

I would like to get host hardware info, something like this but with more information:

Get-VMHost |Sort Name |Get-View | Select Name, @{N=“Type“;E={$_.Hardware.SystemInfo.Vendor+ “ “ + $_.Hardware.SystemInfo.Model}}, @{N=“CPU“;E={“PROC:“ + $_.Hardware.CpuInfo.NumCpuPackages + “ CORES:“ + $_.Hardware.CpuInfo.NumCpuCores + “ MHZ: “ + [math]::round($_.Hardware.CpuInfo.Hz / 1000000, 0)}}, @{N=“MEM“;E={“” + [math]::round($_.Hardware.MemorySize / 1GB, 0) + “ GB“}} | ` Export-Csv -NoTypeInformation C:\Users\gemela\Desktop\VM_CLuster_Host_Datastore.csv

What I need is:

Hostname

Cluster

Cpu Model

Cores for Cpu

Logical Processors

Vendor

Model

Speed

Memory GB

Network Nic Count 1Gb/s (Management, Production,Backup)

SAN FC

Local Disk

Active?

Available

Is possible to get all info in one script?

Thanks

12 Replies
LucD
Leadership
Leadership

Yes


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

0 Kudos
antoniogemelli
Hot Shot
Hot Shot

Currently I extracting those info with RvTools.

0 Kudos
antoniogemelli
Hot Shot
Hot Shot

Hi LucD,

I'm lost here,

Not sure if I can get Local Disk name example HP 2x279 GB RAID1 7.2K rpm Only for Hypervizor

and SAN FC Like: 2x4GB Hitachi Data Systems VSP, Hitachi Data Systems VSP G100 Full equipment.

get-vmhost | Select name,

@{N="Host";E={($_ | Get-VMHostNetwork).Hostname}},

@{N=”Datacenter”;E={Get-Datacenter -VMHost $_}},

@{N=”Cluster”;E={($_ | get-cluster).Name}},

@{N=“Cpu Model“;E={($_| Get-View).Hardware.CpuPkg[0].Description}},

@{N=“Speed“;E={"" + [math]::round(($_| get-view).Hardware.CpuInfo.Hz / 1000000, 0)}},

@{N="HT Available";E={($_).HyperthreadingActive}},

@{N="HT Active";E={($_ | get-view).Config.HyperThread.Active}},

@{N=“# CPU“;E={($_| Get-View).Hardware.CpuInfo.NumCpuPackages}},

@{N="Cores per CPU";E={($_| Get-View).Hardware.CpuInfo.NumCpuCores /($_| Get-View).Hardware.CpuInfo.NumCpuPackages}},

@{N=“#Cores“;E={($_| Get-View).Hardware.CpuInfo.NumCpuCores}},

@{N='Vendor';E={($_| Get-View).Summary.Hardware.Vendor}},

@{N=“Model“;E={($_| Get-View).Hardware.SystemInfo.Vendor+ “ “ + ($_| Get-View).Hardware.SystemInfo.Model}},

@{N=“Memory GB“;E={“” + [math]::round(($_| get-view).Hardware.MemorySize / 1GB, 0) + “ GB“}},

@{N=“Type“;E={$_.Hardware.SystemInfo.Vendor+ “ “ + $_.Hardware.SystemInfo.Model}},

@{n="HostUUID";e={$_.ExtensionData.hardware.systeminfo.uuid}},

@{N=”NTP”;E={Get-VMHostNtpServer $_}},

@{N="Datastore";E={Get-Datastore -VM $_}},

@{N="LUN";E={$lun.CanonicalName}}| Export-csv C:\Users\gemela\Desktop\ClusterESXTECOPROD.csv –NoTypeInformation

Any suggestion?

0 Kudos
LucD
Leadership
Leadership

Under which RVTools tab, and in which column do you get that info?


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

0 Kudos
antoniogemelli
Hot Shot
Hot Shot

Most of the info I can get with vHost tab,

Like:

Host

Datacenter

Cluster

CPU Model

Speed

HT Available

HT Active

#Cpu

Cores per CPU

Cores

Memory

Model

UTC

In tab vDatastore

Datastore

With the last code I can get almost everythings need except Local Disk and SAN FC.

0 Kudos
LucD
Leadership
Leadership

What exactly do you want to see under Local Disk and SAN FC?

Is that info available in the Web Client?

Can you give an example? Screenshot?


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

0 Kudos
antoniogemelli
Hot Shot
Hot Shot

I have an old report but I don't know how they get this info, looks like if they taken from HP Blade:  

SAN FCLocal Disk
2x4GB Hitachi Data Systems VSP, Hitachi Data Systems VSP G100 Full equipmentHP 2x279 GB RAID1 7.2K rpm Only for Hypervizor
2x4GB Hitachi Data Systems VSP, Hitachi Data Systems VSP G100 Full equipmentHP 2x279 GB RAID1 7.2K rpm Only for Hypervizor
2x4GB Hitachi Data Systems VSP, Hitachi Data Systems VSP G100 Full equipmentHP 2x279 GB RAID1 7.2K rpm Only for Hypervizor
0 Kudos
LucD
Leadership
Leadership

Does this returns part of that info?

It depends how much ESXi can "see" from the HW, in other words how the HW made that info available.

$esx = Get-VMHost MyEsx

$esxcli = Get-EsxCli -VMHost $esx

# Local disk

$esxcli.storage.core.device.list() | where{$_.DeviceType -eq 'Direct-Access' -and $_.IsLocal -eq 'true'} |

Select DisplayName,Device,Vendor,Model,Revision

# SAN FC

$esxcli.storage.core.device.list() | where{$_.DeviceType -eq 'Direct-Access' -and $_.IsLocal -eq 'false' -and $_.IsSharedClusterWide -eq 'True'} |

Select DisplayName,Device,Vendor,Model,Revision


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

0 Kudos
antoniogemelli
Hot Shot
Hot Shot

Works, but no output.

0 Kudos
LucD
Leadership
Leadership

That's what I was afraid of, it really depends on the HW vendor and model if the info can be obtained this way.


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

antoniogemelli
Hot Shot
Hot Shot

Problem can be resolved if I install HPE  tools but I can't now (no admin right on the jump server)

0 Kudos
David_Stewart1
Contributor
Contributor

Get-VMHost | Sort Name | %{$VMHost = $_; $VMHost | Get-View | Select @{N=”ESXi Host Name”;E={$VMHost.Name}}, @{N=”Datacenter”;E={$VMHost.Parent.ParentFolder.Parent.Name}}, @{N=”Cluster”;E={$VMHost.Parent.Name}}, @{N='Vendor';E={$_.Summary.Hardware.Vendor}},@{N="HostModel";E={$_.Hardware.SystemInfo.Model}}, @{N="ESXi Version";E={$_.Config.Product.FullName}}, @{N="CPU Model";E={$_.Hardware.CpuPkg[0].Description}}, @{N="CPU MHZ";E={[math]::round($_.Hardware.CpuInfo.Hz / 1000000, 0)}}, @{N="HyperThreading";E={$_.Config.HyperThread.Active}}, @{N="CPUs(Sockets)";E={$_.Hardware.CpuInfo.NumCpuPackages}}, @{N="Cores per CPU";E={($_.Hardware.CpuInfo.NumCpuCores) /($_.Hardware.CpuInfo.NumCpuPackages)}}, @{N="Total Cores";E={$_.Hardware.CpuInfo.NumCpuCores}}, @{N="Threads";E={$_.Hardware.CpuInfo.NumCpuThreads}}, @{N="MEM GB";E={"" + [math]::round($_.Hardware.MemorySize / 1GB, 0)}}} | Export-csv $env:userprofile\Documents\VMHost_HW.csv –NoTypeInformation