Get-VMSnapshot
Get-VMSnapshot
Gets the snapshots associated with a virtual machine or snapshot.
Syntax
Parameter Set: Child
Get-VMSnapshot [[-Name] <String> ] -ChildOf <VMSnapshot> [-SnapshotType <SnapshotType> ] [ <CommonParameters>]
Parameter Set: Id
Get-VMSnapshot [-Id] <Guid> [-ComputerName <String[]> ] [ <CommonParameters>]
Parameter Set: Parent
Get-VMSnapshot [[-Name] <String> ] -ParentOf <VirtualMachineBase> [-SnapshotType <SnapshotType> ] [ <CommonParameters>]
Parameter Set: VMName
Get-VMSnapshot [-VMName] <String[]> [[-Name] <String> ] [-ComputerName <String[]> ] [-SnapshotType <SnapshotType> ] [ <CommonParameters>]
Parameter Set: VMObject
Get-VMSnapshot [-VM] <VirtualMachine[]> [[-Name] <String> ] [-SnapshotType <SnapshotType> ] [ <CommonParameters>]
Detailed Description
The Get-VMSnapshot cmdlet gets the snapshots associated with a virtual machine or snapshot.
Parameters
-ChildOf<VMSnapshot>
Specifies the snapshot whose child snapshots are to be retrieved. This retrieves immediate children only.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ComputerName<String[]>
Specifies one or more Hyper-V hosts on which snapshots are to be retrieved. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer — use “localhost” or a dot (“.”) to specify the local computer explicitly.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
. |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Id<Guid>
Specifies the unique identifier of the virtual machine whose snapshots are to be retrieved.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue, ByPropertyName) |
Accept Wildcard Characters? |
false |
-Name<String>
Specifies the name of the snapshot to be retrieved.
Aliases |
none |
Required? |
false |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ParentOf<VirtualMachineBase>
Specifies the snapshot whose immediate parent snapshot is to be retrieved.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-SnapshotType<SnapshotType>
Specifies the type of the snapshots to be retrieved. Allowed values are Standard, Recovery, Planned, Missing, Replica, AppConsistentReplica, and SyncedReplica.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VM<VirtualMachine[]>
Specifies the virtual machine whose snapshots are to be retrieved.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-VMName<String[]>
Specifies the name of the virtual machine whose snapshots are to be retrieved.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- Microsoft.Virtualization.Powershell.Snapshot
Examples
Example 1
Gets all snapshots of virtual machine TestVM.
PS C:\> Get-VMSnapshot –VMName TestVM
Example 2
Gets all standard snapshots of virtual machine TestVM.
PS C:\> Get-VM –Name TestVM | Get-VMSnapshot –SnapshotType Standard
Example 3
Gets the immediate parent of snapshot Before applying updates of virtual machine TestVM.
PS C:\> $snapshot = Get-VMSnapshot –Name ‘Before applying updates’ –VMName TestVM
PS C:\> Get-VMSnapshot –ParentOf $snapshot
Example 4
Gets the immediate child snapshots of snapshot Before applying updates of virtual machine TestVM.
PS C:\> $snapshot = Get-VMSnapshot –Name ‘Before applying updates’ –VMName TestVM
PS C:\> Get-VMSnapshot –ChildOf $snapshot