Documentation – ESXi Host Hardware and Build Details

I don’t know many people that enjoy writing documentation but it is a nessesary evil and can give you the opportunity to be creative with how you produce it.

Often I will need to document a point in time install for ESXi hosts so have put together the below PowerCLI function to obtain some hardware and build information back. 

Running Get-HostDetails after connecting to a host or vCenter

There are loads of good examples available but this works well for me.

function Get-HostDetails {
Param(
    
    [string]$ESX = '*'
    )

<#
.Synopsis
The Get-HostDetails retrieves Information regarding build numbers of ESXi hosts
.EXAMPLE
Get-HostDetails
.EXAMPLE
Get-HostDetails -ESX "esx1.domain.com"
.EXAMPLE
$info = Get-HostDetails -ESX "esx1.domain.com","esx2.domain.com"
.NOTES
Chris Tucker 
@CT_Technical
#>

$myESXiHosts = Get-VMHost $ESX

$HostAudit = @()

foreach ($VMHost in $myesxihosts) {

$HostDetails = New-Object PSObject
$HostDetails | Add-Member -name "Hostname" -Value $VMHost.name -MemberType NoteProperty
$HostDetails | Add-Member -name "ESXi Version" -Value $VMHost.Version -MemberType Noteproperty
$HostDetails | Add-Member -name "Build" -Value $VMHost.Build -MemberType Noteproperty
$HostDetails | Add-Member -name "Make" -Value $VMHost.Manufacturer -MemberType Noteproperty
$HostDetails | Add-Member -name "Model" -Value $VMHost.Model -MemberType Noteproperty
$HostDetails | Add-Member -name "Tag" -Value (Get-EsxCli -VMHost $VMHost.Name).hardware.platform.get().SerialNumber -MemberType Noteproperty
$HostDetails | Add-Member -name "Date Checked" -Value (Get-Date -format d) -MemberType NoteProperty

$HostAudit += $HostDetails

}

Write-Output $HostAudit

}

Output as below

Share

You may also like...

Leave a Reply

Your email address will not be published.