Restore-SCVMCheckpoint

Restores a virtual machine to a specified checkpoint.

Syntax

Restore-SCVMCheckpoint
       -VMCheckpoint <VMCheckpoint>
       [-RunAsynchronously]
       [-PROTipID <Guid>]
       [-JobVariable <String>]
       [-WhatIf]
       [-Confirm]
       [-OnBehalfOfUser <String>]
       [-OnBehalfOfUserRole <UserRole>]
       [<CommonParameters>]

Description

The Restore-SCVMCheckpoint cmdlet restores a virtual machine to a specified checkpoint. A virtual machine checkpoint is a point-in-time "snapshot" of a virtual machine. You can use the checkpoint to revert a virtual machine to a previous state.

If the restore operation is successful, the Restore-VMCheckpoint cmdlet returns the checkpoint object. If the operation fails, the cmdlet returns an error message.

Restoring a virtual machine to an earlier checkpoint discards all changes made to the virtual machine since the most recent checkpoint was created. However, all checkpoints, including those made after the checkpoint to which you restore a virtual machine, remain available. Therefore, a good practice is to create a new checkpoint before you restore the virtual machine to ensure that the current state of the virtual machine is available after the restore operation.

Examples

Example 1: Restore a virtual machine to its most recent checkpoint

PS C:\> Get-SCVMCheckpoint -VM "VM01" -MostRecent | Restore-SCVMCheckpoint

This command gets the most recent checkpoint object for virtual machine VM01 and restores VM01 to the state that it was in at the time its most recent checkpoint was created.

Example 2: Restore a virtual machine to the specified checkpoint

PS C:\> $Checkpoints = Get-SCVMCheckpoint -VM "VM02"
PS C:\> Restore-SCVMCheckpoint -VMCheckpoint $Checkpoints[$Checkpoints.count - 2]

The first command gets all checkpoint objects for virtual machine VM02 and stores the objects in the $Checkpoints object array.

The second command restores VM02 to the second-from-last checkpoint (this example assumes you have at least two checkpoints). VMM retains the checkpoints created after the checkpoint that you restore to, enabling you to restore the virtual machine to a later checkpoint. To restore a virtual machine to its most recent checkpoint, see Example 1.

Example 3: View the hardware profile of the last restored checkpoint on a virtual machine

PS C:\> $VM = Get-SCVirtualMachine -Name "VM02"
PS C:\> $VM.LastRestoredVMCheckpoint.CheckpointHWProfile

The first command gets the virtual machine object named VM02 and stores the object in the $VM variable.This example assumes that the virtual machine has been restored to one of its checkpoints.

The second command displays information about the hardware profile of the last restored checkpoint on VM02.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JobVariable

Specifies that job progress is tracked and stored in the variable named by this parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OnBehalfOfUser

Specifies the name of a user. This cmdlet sets the on behalf of user as the user that this parameter specifies.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OnBehalfOfUserRole

Specifies a user role. To obtain a user role, use the Get-SCUserRole cmdlet. This cmdlet operates on behalf of the user role that this parameter specifies.

Type:UserRole
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VMCheckpoint

Specifies a Virtual Machine Manager (VMM) virtual machine checkpoint object.

Type:VMCheckpoint
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

VMCheckpoint

This cmdlet returns a VMCheckpoint object.

Notes

  • Requires a VMM checkpoint object, which you can retrieve by using the Get-SCVMCheckpoint cmdlet.