none
manually delete a specific recover point RRS feed

  • Question

  • I've probably asked this in 5 different places now with no answer.  How can I delete a specific recovery point through powershell on DPM 2010 3.0.7707??

    I've tried multiples of scripts and sites and none work.  I can view my protection groups on the server and see the recovery points there, but can't find a way that works to delete the oldest recovery point for a specific Protection Group.  This has killed my backup for nearly a month now!  Please help!

    I run the following:

    $pgList = Get-ProtectionGroup graybackup
    $pgList | ft -auto

    I can now see my list of groups.

    I try the following and it doesn't work.

    $a = read-host “Select Protection Group (0, 1, 2, 3, 4, 5, 6)”

    and here is the rest...........

    $dslist = get-datasource $pglist[6]
    $dslist | ft -auto
    $b = read-host “Select System (0, 1, 2, 3, 4, 5, 6)”
    $rplist=get-recoverypoint $dslist[$b]
    $rplist | ft -auto
    $c = read-host “Select Recovery Point to be deleted (0, 1, 2, 3, 4, 5, 6)”
    remove-recoverypoint -recoverypoint $rplist[$c] -confirm

    Monday, May 7, 2012 8:15 PM

All replies

  • I have the recovery point I want to delete here :

    \Backup Using Child Partition Snapshot\grayfile on computer GRAYVIRTUAL1.xxx.dp
      Recovery Point #3 RPtime=4/14/2012 6:24:15 PM

    Monday, May 7, 2012 9:35 PM
  • Could you try this?

    Just change the 3 parameters and that should work

    $TARGET_PROTECTION_GROUP is the explicit name of the PG.

    $DPM_SERVER_NAME = "***"
    $TARGET_PROTECTION_GROUP = ""
    $RP_EXPIRATION_DATE = "07/03/2011 04:00:00 AM

    function Remove-Old_RP
    {
    $pg = Get-ProtectionGroup -DPMServerName $DPM_SERVER_NAME | Where-Object {$_.FriendlyName.ToUpper() -eq $TARGET_PROTECTION_GROUP.ToUpper()}
    $dslist = Get-Datasource -ProtectionGroup $pg
    if ($dslist -ne $NULL)
    {
    ### for ($i=0; $i -le $ds.Length – 1; $i++)
        foreach ($ds in $dslist)
        {
        $rplist = Get-RecoveryPoint -Datasource $ds | where {$_.RepresentedPointInTime -le $RP_EXPIRATION_DATE}
        
        if ($rplist -ne $NULL)
        {
        foreach($rp in $rplist)
        {
            Remove-RecoveryPoint $rp -ForceDeletion
        }
        }
        }
    }

    Monday, May 7, 2012 10:59 PM
  • Where do I find the $RP_EXPIRATION_DATE = value???  I don't see that anywhere, only the Creation time of the RP.
    Tuesday, May 8, 2012 3:03 PM
  • The expiration date is a variable.
    You can set it to the the creation time of the RP (or 1 minute afterwards).
    Tuesday, May 8, 2012 8:32 PM
  • Thanks for the response, but it is still failing.  I'm new to this so I'm probably doing it wrong, but I'm taking your script and putting it into a .ps1 file.  I am getting errors that it is missing a closing }  I can't see where it is missing.

    $DPM_SERVER_NAME = "***"
    $TARGET_PROTECTION_GROUP = ""
    $RP_EXPIRATION_DATE = "07/03/2011 04:00:00 AM

    function Remove-Old_RP
    {
    $pg = Get-ProtectionGroup -DPMServerName $DPM_SERVER_NAME | Where-Object {$_.FriendlyName.ToUpper() -eq $TARGET_PROTECTION_GROUP.ToUpper()}
    $dslist = Get-Datasource -ProtectionGroup $pg
    if ($dslist -ne $NULL)
    {
    ### for ($i=0; $i -le $ds.Length – 1; $i++)
        foreach ($ds in $dslist)
        {
        $rplist = Get-RecoveryPoint -Datasource $ds | where {$_.RepresentedPointInTime -le $RP_EXPIRATION_DATE}
        
        if ($rplist -ne $NULL)
        {
        foreach($rp in $rplist)
        {
            Remove-RecoveryPoint $rp -ForceDeletion
        }
        }
        }
    }

    Tuesday, May 8, 2012 8:45 PM
  • Just add a } at the end and then execute the function in your ps1.

    The missing one was the function closing one.

    Wednesday, May 9, 2012 12:04 AM
  • Thanks for the reply again.  It seems it is still not doing anything.  It now doesn't error, but immediately just goes to the next line as it would if you just hit enter.  Here is what I have in my .ps1 file:

    $DPM_SERVER_NAME = "graybackup"
    $TARGET_PROTECTION_GROUP = "Grayfile VHD"
    $RP_EXPIRATION_DATE = "4/14/2012 6:24:15 PM"

    function Remove-Old_RP
    {
    $pg = Get-ProtectionGroup -DPMServerName $DPM_SERVER_NAME | Where-Object {$_.FriendlyName.ToUpper() -eq $TARGET_PROTECTION_GROUP.ToUpper()}
    $dslist = Get-Datasource -ProtectionGroup $pg
    if ($dslist -ne $NULL)
    {
    ### for ($i=0; $i -le $ds.Length – 1; $i++)
        foreach ($ds in $dslist)
        {
        $rplist = Get-RecoveryPoint -Datasource $ds | where {$_.RepresentedPointInTime -le $RP_EXPIRATION_DATE}
       
        if ($rplist -ne $NULL)
        {
        foreach($rp in $rplist)
        {
            Remove-RecoveryPoint $rp -ForceDeletion
        }
        }
        }
    }
    }

    Here is the result:

    PS C:\Program Files\Microsoft DPM\DPM\bin> .\DeleteRecoveryPoint.ps1
    PS C:\Program Files\Microsoft DPM\DPM\bin>

    Wednesday, May 9, 2012 7:05 PM
  • That's because the Remove-Old_RP function is not called inside your script. It is just defined.

    Your script should contain something like this:

    $DPM_SERVER_NAME = "graybackup"
    $TARGET_PROTECTION_GROUP = "Grayfile VHD"
    $RP_EXPIRATION_DATE = "4/14/2012 6:24:15 PM"

    function Remove-Old_RP
    {
    $pg = Get-ProtectionGroup -DPMServerName $DPM_SERVER_NAME | Where-Object {$_.FriendlyName.ToUpper() -eq $TARGET_PROTECTION_GROUP.ToUpper()}
    $dslist = Get-Datasource -ProtectionGroup $pg
    if ($dslist -ne $NULL)
    {
    ### for ($i=0; $i -le $ds.Length – 1; $i++)
        foreach ($ds in $dslist)
        {
        $rplist = Get-RecoveryPoint -Datasource $ds | where {$_.RepresentedPointInTime -le $RP_EXPIRATION_DATE}
       
        if ($rplist -ne $NULL)
        {
        foreach($rp in $rplist)
        {
            Remove-RecoveryPoint $rp -ForceDeletion
        }
        }
        }
    }
    }

    function Script-Main
    {
    Connect-DPMServer $DPM_SERVER_NAME
    Remove-Old_RP
    }

    Script-Main

    Thursday, May 10, 2012 9:35 AM
  • AWESOME!  That deleted the recovery points!  Now it did not free up any space after deleting them....  Shouldn't it have done that?  I started a consistency check, but disk management didn't show any more free space than before I deleted the two recovery points.  Thanks again for all your help!
    Thursday, May 10, 2012 3:21 PM