Get-VMHost
This cmdlet retrieves the hosts on a vCenter Server system. Returns a set of hosts that correspond to the filter criteria provided by the cmdlet parameters. To specify a server different from the default one, use the Server parameter. When working directly on an ESX host, the Name property of the returned VMHost object contains either the DNS name or the IP of the ESX host, depending on which of them was specified when connecting with Connect-VIServer.
Syntax
[-Location <VIContainer[]>]
[-Name <String[]>]
[-NoRecursion]
[-Server <VIServer[]>]
[-State <VMHostState[]>]
[-Tag <Tag[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
optional |
|
StorageResource[] | named |
|
Specifies the datastores or datastore clusters to which the hosts that you want to retrieve are associated. Passing values to this parameter through a pipeline is deprecated and will be removed in a future release. | optional |
|
VIContainer[] | named |
|
Specifies the vSphere container objects (such as folders, datacenters, and clusters) you want to search for hosts. | optional |
|
String[] | named |
|
Specifies the names of the hosts you want to retrieve. | optional |
|
SwitchParameter | named |
|
Indicates that you want to deactivate the recursive behavior of the command. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | optional |
|
VMHostState[] | named |
|
Specifies the state of the hosts you want to retrieve. The valid values are Connected, Disconnected, NotResponding, and Maintenance. | optional |
|
Tag[] | named |
|
Returns only the virtual machine hosts that are associated with any of the specified tags. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
String[] | named |
|
Specifies the IDs of the hosts you want to retrieve. Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that matches exactly one of the string values in that list. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. |
[-Name <String[]>]
[-Server <VIServer[]>]
[-Tag <Tag[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
optional |
|
DistributedSwitch[] | named |
|
Filters the available hosts by the virtual switches they are connected to. | optional |
|
String[] | named |
|
Specifies the names of the hosts you want to retrieve. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | optional |
|
Tag[] | named |
|
Returns only the virtual machine hosts that are associated with any of the specified tags. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
VMHostRelatedObjectBase[] | named |
|
Specifies objects to retrieve one or more VMHost objects that are related to them. This parameter accepts OMResource objects. |
[-Location <VIContainer[]>]
[-Name <String[]>]
[-NoRecursion]
[-ResourcePool <ResourcePool[]>]
[-Server <VIServer[]>]
[-Tag <Tag[]>]
[-VM <VirtualMachine[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
optional |
|
StorageResource[] | named |
|
Specifies the datastores or datastore clusters to which the hosts that you want to retrieve are associated. Passing values to this parameter through a pipeline is deprecated and will be removed in a future release. | optional |
|
VIContainer[] | named |
|
Specifies the vSphere container objects (such as folders, datacenters, and clusters) you want to search for hosts. | optional |
|
String[] | named |
|
Specifies the names of the hosts you want to retrieve. | optional |
|
SwitchParameter | named |
|
Indicates that you want to deactivate the recursive behavior of the command. | optional |
|
ResourcePool[] | named |
|
Specifies resource pools associated with the hosts you want to retrieve. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | optional |
|
Tag[] | named |
|
Returns only the virtual machine hosts that are associated with any of the specified tags. | optional |
|
VirtualMachine[] | named |
|
Specifies virtual machines whose hosts you want to retrieve. |
Output
VMware.VimAutomation.ViCore.Types.V1.Inventory.VMHost
Examples
Example 1
Retrieves all hosts in the specified datacenter.
Example 2
Retrieves the host on which the specified virtual machine runs.
Example 3
Retrieves all hosts associated with the specified vSphere distributed switch.
Related Commands
VMHost
VMHostAccount
VMHostAdvancedConfiguration
VMHostAuthentication
VMHostAvailableTimeZone
VMHostDiagnosticPartition
VMHostDisk
VMHostDiskPartition
VMHostFirewallDefaultPolicy
VMHostFirewallException
VMHostFirmware
VMHostHardware
VMHostHba
VMHostModule
VMHostNetwork
VMHostNetworkAdapter
VMHostNetworkStack
VMHostNtpServer
VMHostPatch
VMHostPciDevice
VMHostProfile
VMHostProfileCompliance
VMHostProfileImageCacheConfiguration
VMHostProfileRequiredInput
VMHostProfileStorageDeviceConfiguration
VMHostProfileUserConfiguration
VMHostProfileVmPortGroupConfiguration
VMHostRoute
VMHostService
VMHostSnmp
VMHostStartPolicy
VMHostStorage