Get-VMHost: Difference between revisions

From VI-Toolkit
Jump to navigation Jump to search
New page: NAME Get-VMHost SYNOPSIS Gets from a VMware Infrastructure server one or more virtual machine hosts. SYNTAX Get-VMHost [-Datastore <Datastore[]>] [-State <VMHostState...
 
No edit summary
 
Line 1: Line 1:
NAME
=====NAME=====
     Get-VMHost
     Get-VMHost
      
      
Line 15: Line 15:
      
      
      
      
DETAILED DESCRIPTION
=====DETAILED DESCRIPTION=====
    Gets from a VMware Infrastructure server one or more objects that represent
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.
    virtual machine hosts. Returns the set of virtual machine hosts that corre
 
    spond to the filter criteria provided by the cmdlet parameters.  To specify
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.
    a server different from the default one, use the -Server parameter.
    When connected directly to an ESX host, the Name property of the returned V
    MHost object  contains either the DNS name of the host, or the IP of the ES
    X host, depending on which of them was specified when connecting with Conne
    ct-VIServer.
      
      


Line 29: Line 24:
     -Datastore <Datastore[]>
     -Datastore <Datastore[]>
         If set, the command retrieves the virtual machine hosts associated with
         If set, the command retrieves the virtual machine hosts associated with
         one or more of the specified datastores. Passing values to this parame
         one or more of the specified datastores. Passing values to this parameter
         ter through a pipeline is deprecated and will be removed after one of t
         through a pipeline is deprecated and will be removed after one of the
         he following releases.
         following releases.
          
          
         Required?                    false
         Required?                    false
Line 51: Line 46:
          
          
     -Location <VIContainer[]>
     -Location <VIContainer[]>
         Specifies one or more virtual infrastructure container objects (e.g. fo
         Specifies one or more virtual infrastructure container objects (e.g. folders,
         lders, datacenters, clusters) to search for virtual machine hosts.
         datacenters, clusters) to search for virtual machine hosts.
          
          
         Required?                    false
         Required?                    false
Line 81: Line 76:
          
          
     -NoRecursion
     -NoRecursion
         Get-VMHost searches recursively from any provided starting point. Setti
         Get-VMHost searches recursively from any provided starting point. Setting
         ng this parameter disables the command recursive behavior.
         this parameter disables the command recursive behavior.
          
          
         Required?                    false
         Required?                    false
Line 92: Line 87:
     -Server <VIServer[]>
     -Server <VIServer[]>
         A VMware Infrastructure server to apply the command on. If no value is  
         A VMware Infrastructure server to apply the command on. If no value is  
         given to this parameter, the command takes the server currently specifi
         given to this parameter, the command takes the server currently specified
         ed in the $DefaultVIServer variable.
         in the $DefaultVIServer variable.
          
          
         Required?                    false
         Required?                    false
Line 102: Line 97:
          
          
     -VM <VirtualMachine[]>
     -VM <VirtualMachine[]>
         Specifies one or more virtual machines running on the virtual machine h
         Specifies one or more virtual machines running on the virtual machine hosts
         osts retrieved by the command.
         retrieved by the command.
          
          
         Required?                    false
         Required?                    false
Line 112: Line 107:
          
          
     -ResourcePool <ResourcePool[]>
     -ResourcePool <ResourcePool[]>
         Specifies one or more resource pools associated with the standalone vir
         Specifies one or more resource pools associated with the standalone virtual
         tual machine hosts retrieved by the command.
         machine hosts retrieved by the command.
          
          
         Required?                    false
         Required?                    false
Line 135: Line 130:
      
      
      
      
NOTES
=====NOTES=====
      
      
      
      
        When connected directly to ESX, the Name property of the returned VMHos
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.
        t 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 --------------
     --------------  Example 1 --------------
      
      
     C:\PS>Get-VMHost -Location (Get-Datacenter -Name New) -VM (Get-VM -Name "MS
     C:\PS>Get-VMHost -Location (Get-Datacenter -Name New) -VM (Get-VM -Name "MS Win XP SP2") | fl
    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.
    Retrieves the virtual machine host, which is located in the New datacenter  
    and on which the MS Win XP SP2 virtual machine is hosted.
      
      
      
      
Line 160: Line 149:
      
      
      
      
RELATED LINKS
=====RELATED LINKS=====
     [[Remove-VMHost]]
     [[Remove-VMHost]]
     [[Move-VMHost]]
     [[Move-VMHost]]
     [[Set-VMHost]]
     [[Set-VMHost]]
     [[Add-VMHost]]
     [[Add-VMHost]]
[[Category: Powershell]][[Category: VI-Toolkit]]

Latest revision as of 14:24, 24 March 2009

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