Get-VMHost
NAME
Get-VMHost
SYNOPSIS
Gets from a VMware Infrastructure server one or more virtual machine hosts.
SYNTAX
Get-VMHost [-Datastore <Datastore[]>] [-State <VMHostState[]>] [-Location < VIContainer[]>] [[-Name] <String[]>] [-Id <String[]>] [-NoRecursion] [-Serv er <VIServer[]>] [<CommonParameters>] Get-VMHost [-VM <VirtualMachine[]>] [-ResourcePool <ResourcePool[]>] [-Data store <Datastore[]>] [-Location <VIContainer[]>] [[-Name] <String[]>] [-Id <String[]>] [-NoRecursion] [-Server <VIServer[]>] [<CommonParameters>]
DETAILED DESCRIPTION
Gets from a VMware Infrastructure server one or more objects that represent virtual machine hosts. Returns the set of virtual machine 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 connected directly to an ESX host, the Name property of the returned VMHost object contains either the DNS name of the host, or the IP of the ESX host, depending on which of them was specified when connecting with Connect-VIServer.
PARAMETERS
-Datastore <Datastore[]> If set, the command retrieves the virtual machine hosts associated with one or more of the specified datastores. Passing values to this parameter through a pipeline is deprecated and will be removed after one of the following releases. Required? false Position? named Default value Accept pipeline input? true (ByValue) Accept wildcard characters? true -State <VMHostState[]> Specifies the state of the virtual machine hosts to be returned by the Get-VMHost command. It must be one of the following: Connected, Disconn ected, NotResponding, Maintenance. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Location <VIContainer[]> Specifies one or more virtual infrastructure container objects (e.g. folders, datacenters, clusters) to search for virtual machine hosts. Required? false Position? named Default value Accept pipeline input? true (ByValue) Accept wildcard characters? true -Name <String[]> Specifies one or more names of virtual machine hosts to get. Use commas to separate multiple names. Using wildcards is supported. Required? false Position? 1 Default value Accept pipeline input? false Accept wildcard characters? true -Id <String[]> Specifies one or more virtual machine hosts by Id. To specify multiple Ids, use commas to separate the Ids. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? true -NoRecursion Get-VMHost searches recursively from any provided starting point. Setting this parameter disables the command recursive behavior. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Server <VIServer[]> A VMware Infrastructure server to apply the command on. If no value is given to this parameter, the command takes the server currently specified in the $DefaultVIServer variable. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -VM <VirtualMachine[]> Specifies one or more virtual machines running on the virtual machine hosts retrieved by the command. Required? false Position? named Default value Accept pipeline input? true (ByValue) Accept wildcard characters? true -ResourcePool <ResourcePool[]> Specifies one or more resource pools associated with the standalone virtual machine hosts retrieved by the command. Required? false Position? named Default value Accept pipeline input? true (ByValue) Accept wildcard characters? true <CommonParameters> This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer and -OutVariable. For more information, type, "get-help about_commonparameters".
INPUT TYPE
RETURN TYPE
VMHost[]
NOTES
When connected directly to ESX, the Name property of the returned VMHost object contains either the DNS name of the host, or the IP of the ESX, depending on which of them was specified when connecting with Connect-VIServer.
-------------- Example 1 -------------- C:\PS>Get-VMHost -Location (Get-Datacenter -Name New) -VM (Get-VM -Name "MS Win XP SP2") | fl
Retrieves the virtual machine host, which is located in the New datacenter and on which the MS Win XP SP2 virtual machine is hosted.
State : Connected CustomFields : {} ID : HostSystem-host-8 Name : 10.23.113.212
RELATED LINKS
Remove-VMHost Move-VMHost Set-VMHost Add-VMHost