PowerCLI

 View Only
Expand all | Collapse all

Get Hardware info

  • 1.  Get Hardware info

    Posted Oct 05, 2017 01:06 PM

    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



  • 2.  RE: Get Hardware info

    Posted Oct 05, 2017 01:15 PM

    Yes



  • 3.  RE: Get Hardware info

    Posted Oct 05, 2017 01:24 PM

    Currently I extracting those info with RvTools.



  • 4.  RE: Get Hardware info

    Posted Oct 05, 2017 01:50 PM

    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?



  • 5.  RE: Get Hardware info

    Posted Oct 05, 2017 04:25 PM

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



  • 6.  RE: Get Hardware info

    Posted Oct 06, 2017 07:06 AM

    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.



  • 7.  RE: Get Hardware info

    Posted Oct 06, 2017 07:09 AM

    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?



  • 8.  RE: Get Hardware info

    Posted Oct 06, 2017 07:26 AM

    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


  • 9.  RE: Get Hardware info

    Posted Oct 06, 2017 08:21 AM

    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



  • 10.  RE: Get Hardware info

    Posted Oct 06, 2017 09:53 AM

    Works, but no output.



  • 11.  RE: Get Hardware info

    Posted Oct 06, 2017 10:01 AM

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



  • 12.  RE: Get Hardware info

    Posted Oct 06, 2017 10:56 AM

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



  • 13.  RE: Get Hardware info

    Posted Oct 18, 2018 07:34 PM

    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