How to Expire Tape Recovery Points in DPM 2007

 

When running System Center Data Protection Manager 2007 and utilizing the DPM tape libraries capability for protection, it may be necessary to expire tape recovery points prior to “Expires On” date. Tapes which have unexpired data cannot be marked as free from the UI in the DPM Administrators console but sometimes (esp. while testing) users need to override this behavior. The script below allows a user to mark any tape as free so that it’s available for protection by DPM. This same script can be utilized for tape libraries or stand alone tape devices.

To view the expiry date for a tape you can open the DPM Administrator console, click on Management and select the Libraries tab. Identify the tape of interest, right click and select “View tape contents”. This will display a list of recovery points on the tape and the “Expires on” date.

Running the script below will delete ALL the recovery points on the tape and mark it as “Free (contains data)”. This script cannot be used to selectively choose particular recovery points to delete.

CLI Script: Force mark tape as free is also documented at
http://blogs.technet.com/dpm/archive/2007/09/04/cli-script-force-mark-tape-as-free.aspx

RESOLUTION:

Copy the script below to Notepad and save it to C:Program FilesMicrosoft DPMDPMbin folder using a descriptive file name. This is the default installation locate for DPM 2007 but the path may vary if DPM 2007 is installed to an alternate location. Be sure to change the file extension to .ps1 then open the DPM Management Shell. The usage and examples of scripts can be found by calling them with ‘-?’ or ‘-help’ from inside DPM Management Shell.

When you run this it will show confirmation that it is removing recovery points and marking tape as free.  If this returns immediately and does not give any output, the parameters you put in were probably wrong.  SEE EXPECTED OUTPUT BELOW.

COPY AND PASTE FROM HERE>>>

#REM: http://blogs.technet.com/dpm/archive/2007/09/04/cli-script-force-mark-tape-as-free.aspx

param ([string] $DPMServerName, [string] $LibraryName, [string[]] $TapeLocationList)

if((“-?”,”-help”) -contains $args[0])
{
    Write-Host “Usage: ForceFree-Tape.ps1 [[-DPMServerName] <Name of the DPM server>] [-LibraryName] <Name of the library> [-TapeLocationList] <Array of tape locations>”
    Write-Host “Example: Force-FreeTape.ps1 -LibraryName “My library” -TapeLocationList Slot-1, Slot-7″
    exit 0
}

if (!$DPMServerName)
{
    $DPMServerName = Read-Host “DPM server name: ”

    if (!$DPMServerName)
    {
        Write-Error “Dpm server name not specified.”
        exit 1
    }
}

if (!$LibraryName)
{
    $LibraryName = Read-Host “Library name: ”

    if (!$LibraryName)
    {
        Write-Error “Library name not specified.”
        exit 1
    }
}

if (!$TapeLocationList)
{
    $TapeLocationList = Read-Host “Tape location: ”

    if (!$TapeLocationList)
    {
        Write-Error “Tape location not specified.”
        exit 1
    }
}

if (!(Connect-DPMServer $DPMServerName))
{
    Write-Error “Failed to connect To DPM server $DPMServerName”
    exit 1
}

$library = Get-DPMLibrary $DPMServerName | where {$_.UserFriendlyName -eq $LibraryName}

if (!$library)
{
    Write-Error “Failed to find library with user friendly name $LibraryName”
    exit 1
}

foreach ($media in @(Get-Tape -DPMLibrary $library))
{
    if ($TapeLocationList -contains $media.Location)
    {
        if ($media -is [Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.ArchiveMedia])  
        {
            foreach ($rp in @(Get-RecoveryPoint -Tape $media))
            {
                Get-RecoveryPoint -Datasource $rp.Datasource | Out-Null

                Write-Verbose “Removing recovery point created at $($rp.RepresentedPointInTime) for tape in $($media.Location).”
                Remove-RecoveryPoint -RecoveryPoint $rp -ForceDeletion -Confirm:$false
            }

            Write-Verbose “Setting tape in $($media.Location) as free.”
            Set-Tape -Tape $media -Free
        }
        else
        {
            Write-Error “The tape in $($media.Location) is a cleaner tape.”
        }
    }
}

<<<END OF SCRIPT>>>

 

 

Tape Library Devices:

NOTE: In the example below the script was named Force-FreeTape.ps1.

PS C:Program FilesMicrosoft DPMDPMbin> Force-FreeTape.ps1
DPM server name: : Pss-DPM2007
Library name: : Sony LIB-162 Medium Changer
Tape location: : Slot-5
The operation will remove the following recovery point(s) because they have dependencies on each other:

Wednesday, October 29, 2008 7:00:09 PM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Friday, October 31, 2008 7:00:09 PM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Thursday, October 30, 2008 7:00:11 AM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Wednesday, October 29, 2008 7:00:09 AM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Thursday, October 30, 2008 7:00:09 PM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Friday, October 31, 2008 7:00:09 AM

PS C:Program FilesMicrosoft DPMDPMbin>

StandAlone Tape Devices:

NOTE:  You can use the same script on a standalone tape device, you have to fill in the following for tape location:

 

Drive-\.Tape0

where \.Tape0 is the “Windows name of the drive” that is located in the Details pane when selecting the tape.
   (\.Tape# Where # is serial number in most cases)

 

PS C:Program FilesMicrosoft DPMDPMbin> Force-FreeTape.ps1
DPM server name: : sdpm02
Library name: : firestreamer tape drive
Tape location: : drive-\.Tape2147483644
The operation will remove the following recovery point(s) because they have dependencies on each other:

Tuesday, November 04, 2008 12:10:19 PM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Monday, November 03, 2008 9:03:11 PM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Monday, November 03, 2008 9:02:29 PM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Sunday, November 02, 2008 12:10:09 PM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Thursday, October 30, 2008 9:02:35 PM
The operation will remove the following recovery point(s) because they have dependencies on each other:
Thursday, October 23, 2008 9:02:34 PM

Author:
Thomas O’Malley
Senior Support Escalation Engineer
Microsoft Corporation

Technorati Tags: ,