vSphere PowerCLI Reference

Get-Snapshot

Synopsis

Retrieves the virtual machine snapshots available on a vSphere server.

Syntax

Get-Snapshot [[-Name] <String[]>] [-Id <String[]>] [-VM] <VirtualMachine[]> [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

Online version
New-Snapshot
Remove-Snapshot
Set-Snapshot

Detailed Description

Returns information about the snapshots that correspond to the filter criteria provided by the Name and VM parameters. The disk size of the snapshots is retrieved only if you have the "Datastore/Browse datastore" privilege to the datastore where the shapshot is located. Otherwise, the following message is displayed: "Unable to populate snapshot size due to unsiffucient permissions."

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
VMVirtualMachine[]Specify the virtual machines whose snapshots you want to retrieve. The position of this parameter is deprecated and will be changed in a future release. To avoid errors when you run existing scripts on future PowerCLI versions, specify the parameter by name.truetrue (ByValue)
NameString[]Specify the names of the snapshots you want to retrieve.falsefalse
IdString[]Specify the Ids of the snapshots you want to retrieve.falsefalse
ServerVIServer[]Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse

Return Type

Snapshot

Notes

Examples

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

Get-Snapshot -VM VM -Name 'Before ServicePack 2'

Retrieves the snapshot named "Before ServicePack2" of the VM virtual machine.


Copyright © 1998 - 2011 VMware, Inc. All rights reserved.