Once you get the hang of this, it becomes quite easy.
In your case, you want to list all your ESXi hosts and some properties for each host.
The basic idea is to use the Get-VMHost cmdlet.
Like this it will return all the ESXi servers in the vCenter to which you connected.
Get-VMHost
On screen you will see a number of default properties. This is determined by a kind of format file, but leave that for now.
The above cmdlet returns an object that has more properties. To see all the properties do a Get-Member
Get-VMHost | Get-Member
The next step is to select yourself which properties are to be displayed.
For that you use the Select-Object cmdlet, something like this
Get-VMHost | Select Name,Build,ConnectionState
If you want to store the result in a file, you can use for example the Export-Csv cmdlet.
Get-VMHost | Select Name,Build,ConnectionState | Export-Csv C:\report.csv -NoTypeInformation -UseCulture
If you want to learn about parameters that can be used on a cmdlet, you can use the Get-Help cmdlet.
For example
Get-Help Export-Csv -Parameter NoTypeInformation
will give help on that specific parameter. But you can also display the full help with
Get-Help Export-Csv -Full
That is in fact the basic concept behind reporting with PowerCLI/PowerShell;
- get the objects
- chose what you want to display
- optionally save the result to a file
Does this get you on your way to start ?