powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Get-VM



NAME
Get-VM

SYNOPSIS
Retrieves the virtual machines on a vSphere server.

SYNTAX
Get-VM [-Datastore ] [-Location ] [[-Name] ] [-Id ] [-NoRecursion]
[-Server ] []

Get-VM [-DistributedSwitch ] [[-Name] ] [-Id ] [-NoRecursion] [-Server Server[]>] []


DESCRIPTION
Retrieves the virtual machines on a vSphere server. Returns a set of virtual machines that correspond to the filter
criteria provided by the cmdlet parameters. For virtual machines with multiple NICs and 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
Specify datastores to filter the virtual machines associated with them. Passing values to this parameter throug
h 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

-Location
Specify vSphere container objects you want to search for virtual machines. Supported container object types are
: ResourcePool, VApp, VMHost, Folder, Cluster, Datacenter.

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

-Name
Specify the names of the virtual machines you want to retrieve.

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

-Id
Specify the IDs of the virtual machines 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
One or more vSphere servers to apply the command on. If no value is given to this parameter, the command runs o
n the server currently specified in the $DefaultVIServer variable.

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

-DistributedSwitch
Filter the available virtual machines 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
VirtualMachine


NOTES




-------------- EXAMPLE 1 --------------

C:\PS>Get-VM


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





-------------- EXAMPLE 2 --------------

C:\PS>Get-VM -Name VM*


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






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