Get-VM

From VI-Toolkit
Jump to navigation Jump to search
NAME
   Get-VM
   

SYNOPSIS

   Gets from a VMware Infrastructure server one or more virtual machines.
   

SYNTAX

   Get-VM [-Datastore <Datastore[]>] [-Location <VIContainer[]>] [[-Name] <Str
   ing[]>] [-Id <String[]>] [-NoRecursion] [-Server <VIServer[]>] [<CommonPara
   meters>]
   
   
DETAILED DESCRIPTION

Gets from a VMware Infrastructure server one or more objects that represent virtual machines. Returns a set of virtual machines that correspond to the filter criteria provided by the cmdlet parameters. For virtual machines with multiple NICs and therefore multiple IP addresses, the "IPAddress" property of the VMGuest object contains all IP addresses of the virtual machine.

The IP at position 0 is the primary IP address.


PARAMETERS

   -Datastore <Datastore[]>
       Gets the virtual machines associated with one or more of the specified datastores. 
       Passing values to this parameter through a pipeline is deprecated 
       and will be removed in one of the following releases.
       
       Required?                    false
       Position?                    named
       Default value                
       Accept pipeline input?       true (ByValue)
       Accept wildcard characters?  true
       
   -Location <VIContainer[]>
       Specifies one or more virtual infrastructure container objects (e.g. folders, 
       datacenters, clusters) to search for virtual machines.
       
       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 names 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. Use commas to separate 
       multiple IDs.
       
       Required?                    false
       Position?                    named
       Default value                
       Accept pipeline input?       false
       Accept wildcard characters?  true
       
   -NoRecursion
       Get-VM 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[]>
       One or more virtual Infrastructure servers to apply the command on. If 
       no value is given to this parameter, the command takes the server curre
       ntly specified in the $DefaultVIServer variable.
       
       Required?                    false
       Position?                    named
       Default value                
       Accept pipeline input?       false
       Accept wildcard characters?  false
       
   <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
   VirtualMachine[]
    
   
NOTES
   --------------  EXAMPLE 1 --------------
   
   C:\PS>Get-VM
   
   

Retrieves information about all of the virtual machines registered with the currently selected VMware Infrastructure server.



   --------------  EXAMPLE 2 --------------
   
   C:\PS>Get-VM -Name webTier*
   
   

This command retrieves information about all virtual machines registered with the currently-selected VMware Infrastructure server whose names begin with "webTier."



RELATED LINKS
   Remove-VM 
   New-VM 
   Set-VM 
   Move-VM 
   Start-VM 
   Stop-VM 
   Suspend-VM