Retrieving a list of all of your hosts

Similar to the Get-VM cmdlet, which retrieves your virtual machines, is the Get-VMHost cmdlet, which displays your hosts. The Get-VMHost cmdlet has the following syntax. The first parameter set is the default:

Get-VMHost [[-Name] <String[]>] [-NoRecursion] [-Datastore
    <StorageResource[]>] [-State <VMHostState[]>] [-Location
    <VIContainer[]>]
    [-Tag <Tag[]>] [-Server <VIServer[]>][<CommonParameters>]

The second parameter set is for retrieving hosts connected to specific distributed virtual switches:

Get-VMHost [[-Name] <String[]>] [-DistributedSwitch
    <DistributedSwitch[]>] [-Tag <Tag[]>] [-Server <VIServer[]>]
    [<CommonParameters>]

The third parameter set is for retrieving hosts by virtual machine or resource ...

Get Learning PowerCLI - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.