How To Retrieve ESX Host Network Info Using vSphere PowerCLI

Today, I would like to share how to retrieve ESX host network info using vSphere PowerCLI. Make sure you are connected to a vCenter. Below is the one liner command you can retrieve the ESX host network info and export to a CSV file: –

Get-VMHost | Where { $_.ConnectionState -eq "Connected"} | Get-VMHostNetwork | Select Hostname, DomainName, ConsoleGateway, DNSAddress -ExpandProperty ConsoleNic | Select Hostname, DomainName, PortGroupName, IP, SubnetMask, ConsoleGateway, Devicename | Export-Csv -NoTypeInformation C:\Temp\ESXHost.csv