powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Get-VMHost



NAME
Get-VMHost

SYNOPSIS
Retrieves the hosts on a vSphere server.

SYNTAX
Get-VMHost [-Datastore ] [-State ] [-Location ] [[-Name] ] [-I
d ] [-NoRecursion] [-Server ] []

Get-VMHost [-VM ] [-ResourcePool ] [-Datastore ] [-Location iner[]>] [[-Name] ] [-Id ] [-NoRecursion] [-Server ] []

Get-VMHost [-DistributedSwitch ] [[-Name] ] [-Id ] [-NoRecursion] [-Server
] []


DESCRIPTION
Retrieves the hosts on a vSphere server. 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.


PARAMETERS
-Datastore
Specify the datastores to which the hosts that you want to retrieve are associated. Passing values to this para
meter through a pipeline is deprecated and will be removed in a future release.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-State
Specify the state of the hosts you want to retrieve. The valid values are Connected, Disconnected, NotRespondin
g, and Maintenance.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Location
Specify the vSphere container objects (such as folders, datacenters, and clusters) you want to search for hosts
.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-Name
Specify the names of the hosts you want to retrieve.

Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? true

-Id
Specify the IDs of the hosts you want to retrieve.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-NoRecursion
Indicate that you want to disable the recursive behavior of the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Server
Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the co
mmand runs on the default servers. For more information about default servers, see the description of Connect-V
IServer.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-VM
Specify virtual machines whose hosts you want to retrieve.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-ResourcePool
Specify resource pools associated with the hosts you want to retrieve.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-DistributedSwitch
Filter the available hosts by the virtual switches they are connected to.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
VMHost


NOTES


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.

-------------- Example 1 --------------

C:\PS>Get-VMHost -Location Datacenter -VM VM | fl


Retrieves the host, which is located in the datacenter named Datacenter and on which the VM virtual machine is host
ed.






RELATED LINKS
Online version: http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Get-VMHost.html
Add-VMHost
Move-VMHost
Remove-VMHost
Restart-VMHost
Set-VMHost
Start-VMHost
Stop-VMHost
Suspend-VMHost