locked
how to using checkpoint to restore vms in ssp2.0? RRS feed

  • Question

  •  hi:

    Is there more information on checkpoints managment in ssp2.0sp1? 

    Thank you!

    Monday, August 1, 2011 7:18 AM

Answers

  • You could add to the scripts I provided earlier by querying for available checkpoints, then using the powershell command "convertTo-Html" you could display the results with checkboxes for each checkpoint and carry out a postback to delete those checkpoints that you have selected.
    Microsoft Partner
    • Proposed as answer by rEMOTE_eVENT Friday, September 9, 2011 8:12 AM
    • Marked as answer by Santosh Karale Monday, January 23, 2012 3:55 PM
    Friday, September 9, 2011 8:12 AM

All replies

  • UPDATE: All scripts now working: I have updated the syntax in the code blocks below:

    Hi,

    I do not think that checkpoint management is available out of the box in ssp2.0sp1 but custom tasks can be created to manage them using scripting such as powershell. I have created 3 custom tasks: New Checkpoint, Restore-Checkpoint and Remove-Checkpoint.

    # New-VMCheckpoint
    
    param($vmmServer,$vmmServerName,$vmGUID)
    
    
    
    $virtualMachine = $null
    
    $checkpointVM = $null
    
    $flag = 0
    
    $output = $null
    
    $scriptOutput = @()
    
    
    
    $error.clear()
    
    
    
    try
    
    {
    
    
    
    # Get the VM from the SCVMM Server
    
    $virtualMachine = Get-VM -VMMServer $vmmServer -Id $vmGUID
    
    
    
    
    
    if ($error.Count -eq 0 -and $virtualMachine -ne $null )
    
    {
    
      # Create a Checkpoint for the VM
    
      $checkpointVM = New-VMCheckpoint -VM $virtualMachine
    
    }
    
    
    
    if ($error.Count -ne 0 -or $checkpointVM -eq $null)
    
    {
    
     $flag = 1
    
     $output = $error
    
    }
    
    
    
    # Construct the script output and return
    
    $scriptOutput += $flag
    
    if ($output -ne $null)
    
    {
    
     $scriptOutput += $output
    
    }
    
    }
    
    catch
    
    {
    
     $flag = 1
    
     $output = $error
    
     $scriptOutput += $flag
    
     $scriptOutput += $output
    
    }
    
    finally
    
    {
    
     Remove-Variable -Name virtualMachine
    
     Remove-Variable -Name checkpointVM
    
     Remove-Variable -Name flag
    
     Remove-Variable -Name output 
    
     
    
     Remove-Variable -Name vmmServer 
    
     Remove-Variable -Name vmmServerName 
    
     
    
     [GC]::Collect()
    
     
    
     return $scriptOutput
    
    }<br/>
    
    
    # Restore-Checkpoint
    
    param($vmmServer,$vmmServerName,$vmGUID)
    
    
    
    $virtualMachine = $null
    
    $restoreCheckpoint = $null
    
    $flag = 0
    
    $output = $null
    
    $scriptOutput = @()
    
    
    
    $error.clear()
    
    
    
    try
    
    {
    
    
    
    # Get the VM from the SCVMM Server
    
    $virtualMachine = Get-VM -VMMServer $vmmServer -Id $vmGUID
    
    
    
    
    
    if ($error.Count -eq 0 -and $virtualMachine -ne $null )
    
    {
    
      # Restore the latest Checkpoint
    
      $restoreCheckpoint = Get-VMCheckpoint -VM $virtualMachine -MostRecent | restore-VMCheckpoint
    
    }
    
    
    
    if ($error.Count -ne 0 -or $restoreCheckpoint -eq $null)
    
    {
    
     $flag = 1
    
     $output = $error
    
    }
    
    
    
    # Construct the script output and return
    
    $scriptOutput += $flag
    
    if ($output -ne $null)
    
    {
    
     $scriptOutput += $output
    
    }
    
    }
    
    catch
    
    {
    
     $flag = 1
    
     $output = $error
    
     $scriptOutput += $flag
    
     $scriptOutput += $output
    
    }
    
    finally
    
    {
    
     Remove-Variable -Name virtualMachine
    
     Remove-Variable -Name restoreCheckpoint
    
     Remove-Variable -Name flag
    
     Remove-Variable -Name output 
    
     
    
     Remove-Variable -Name vmmServer 
    
     Remove-Variable -Name vmmServerName 
    
     
    
     [GC]::Collect()
    
     
    
     return $scriptOutput
    
    }
    
    
    # Remove-VMCheckpoint
    
    param($vmmServer,$vmmServerName,$vmGUID)
    
    
    
    $virtualMachine = $null
    
    $removeCheckpoint = $null
    
    $flag = 0
    
    $output = $null
    
    $scriptOutput = @()
    
    
    
    $error.clear()
    
    
    
    try
    
    {
    
    
    
    # Get the VM from the SCVMM Server
    
    $virtualMachine = Get-VM -VMMServer $vmmServer -Id $vmGUID
    
    
    
    
    
    if ($error.Count -eq 0 -and $virtualMachine -ne $null )
    
    {
    
      # Removes the most recent Checkpoint
    
      $removeCheckpoint = Get-VMCheckpoint -VM $virtualMachine -MostRecent | Remove-VMCheckpoint 
    
      }
    
    
    
    if ($error.Count -ne 0 -or $removeCheckpoint -eq $null)
    
    {
    
     $flag = 1
    
     $output = $error
    
    }
    
    
    
    # Construct the script output and return
    
    $scriptOutput += $flag
    
    if ($output -ne $null)
    
    {
    
     $scriptOutput += $output
    
    }
    
    }
    
    catch
    
    {
    
     $flag = 1
    
     $output = $error
    
     $scriptOutput += $flag
    
     $scriptOutput += $output
    
    }
    
    finally
    
    {
    
     Remove-Variable -Name virtualMachine
    
     Remove-Variable -Name removeCheckpoint
    
     Remove-Variable -Name flag
    
     Remove-Variable -Name output 
    
     
    
     Remove-Variable -Name vmmServer 
    
     Remove-Variable -Name vmmServerName 
    
     
    
     [GC]::Collect()
    
     
    
     return $scriptOutput
    
    }
    
    

     

     

     

     


    Microsoft Partner
    • Edited by rEMOTE_eVENT Tuesday, August 2, 2011 11:52 AM sp
    • Proposed as answer by rEMOTE_eVENT Tuesday, August 2, 2011 11:53 AM
    Tuesday, August 2, 2011 11:25 AM
  • hi:

    thanks very much.

    but i want to know how to select on  checkpoint to restore from four checkpoints,your scripts only can process one....

    Wednesday, August 3, 2011 3:07 AM
  • Hi,

    VMMSSP does not provide the CheckPoint management by default. However you can add custom actions and script to acheive this.

    Thanks,

    Santosh

    Thursday, September 8, 2011 7:16 PM
  • You could add to the scripts I provided earlier by querying for available checkpoints, then using the powershell command "convertTo-Html" you could display the results with checkboxes for each checkpoint and carry out a postback to delete those checkpoints that you have selected.
    Microsoft Partner
    • Proposed as answer by rEMOTE_eVENT Friday, September 9, 2011 8:12 AM
    • Marked as answer by Santosh Karale Monday, January 23, 2012 3:55 PM
    Friday, September 9, 2011 8:12 AM