VMware Cloud Community
antoniogemelli
Hot Shot
Hot Shot

Get ESXI info

Hello,

I have this script to check each host, I would like to add some columns:

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='InstallDate';E={(Get-Date "1970-1-1").AddSeconds([int]"0x$((Get-EsxCli -VMHost $_).system.uuid.get().Split('-')[0])")}}| Export-csv C:\Users\gemela\Desktop\ClusterESXT.csv –NoTypeInformation

I would like to have esxi version too, example vCenter version : 5.1 build 1882349

And also if possible in the same script, get ILO Firmware, example HP Smart Array Controller HPSA1 Firmware 3.56

Thanks

3 Replies
LucD
Leadership
Leadership

The following will get you the product version and build.

For the iLO firmware version, it depends on the manufacturer, the model and the vSphere version, what information is available.

Many methods have been mentioned, not sure if they will work in your specific environment.

See for example:

Get-VMHost | Select name,  

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

    @{N='Version';E={"$($_.ExtensionData.Config.Product.Name) $($_.Version) build $($_.Build)"}}, 

    @{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='InstallDate';E={(Get-Date "1970-1-1").AddSeconds([int]"0x$((Get-EsxCli -VMHost $_).system.uuid.get().Split('-')[0])")}} |

Export-csv C:\Users\gemela\Desktop\ClusterESXT.csv –NoTypeInformation  


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

antoniogemelli
Hot Shot
Hot Shot

Hello,

I use this script from long time and it was set to run automatically with Task Manager,

Recently I notice an error and report is not generated:

Get-VMHost : 1/10/2020 12:01:15 PM Get-VMHost Unable to connect to the Inventory Service at 'https://******/' which is required

for the tagging functionality. Additional info: An error occurred while sending the request.

At line:5 char:1

+ Get-VMHost | Select name,

+ ~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [Get-VMHost], ViError

    + FullyQualifiedErrorId : ViCore_InventoryServiceProxy_CreateConnectInventoryServiceExceptionWrapper,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetV

   MHost

Get-VMHost : 1/10/2020 12:01:35 PM Get-VMHost Unable to connect to the Inventory Service at 'https://********' which is required for the

tagging functionality. Additional info: An error occurred while sending the request.

At line:5 char:1

+ Get-VMHost | Select name,

+ ~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [Get-VMHost], ViError

    + FullyQualifiedErrorId : ViCore_InventoryServiceProxy_CreateConnectInventoryServiceExceptionWrapper,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetV

   MHost

0 Kudos
LucD
Leadership
Leadership

Looks there might be an issue with the Inventory Service.
Is there a possibility to restart it?


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