Hi,
I am trying to get the VMHost details using below script, but I am getting blank output
Please help
$myesx = VMhost1
$report = Get-VMHost $myesx |
ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $_
$nic = Get-VMHostNetworkAdapter -VMHost $_ | Select -First 1 | select -ExpandProperty Name
$hba =Get-VMHostHBA -VMHost $_ -Type FibreChannel | where {$_.Status -eq "online"} | Select -First 1 |select -ExpandProperty Name
Get-VMHostHBA -VMHost $_ -Type FibreChannel | where {$_.Status -eq "online"} |
Select @{N="Host_Name";E={$($_.VMHost | Get-VMHostNetwork).HostName}},
@{N="Host_IP";E={($_.ExtensionData.Config.Network.Vnic | ? {$_.Device -eq "vmk0"}).Spec.Ip.IpAddress}},
@{N="ESXi_Version";E={$_.version}},
@{N='ESX_Build';E={$_.Build}},
@{N="Host_Manufacturer";E={$_.Manufacturer}},
@{N="Host_Model";E={$_.Model}},
@{N='Serial';E={(Get-EsxCli -VMHost $_).hardware.platform.get().SerialNumber}},
Device,Model,Status,
@{N="WWNN";E={((("{0:X}"-f $_.NodeWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},
@{N="WWPN";E={((("{0:X}"-f $_.PortWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},
@{N="nfnic_vendor";E={$esxcli.hardware.pci.list() | where {$hba -contains $_.VMKernelName} |Select -ExpandProperty VendorName }},
@{N="nfnic_driver";E={$esxcli.system.module.get("nfnic").version}},
@{N="nenic_driver";E={$esxcli.system.module.get("nenic").version}},
@{N="nenic_vendor";E={$esxcli.hardware.pci.list() | where {$nic -contains $_.VMKernelName} |Select -ExpandProperty VendorName }}
}
$report | ft -auto
$report | Export-Excel ".\myreport.xlsx" -AutoFilter -AutoSize