How to mark a DPM tape containing active recovery points as free

Posted by on Mar 8, 2012 in Data Protection Manager, Powershell | 9 comments

When trying to mark a tape that contains active recovery points as free in Data Protection Manager you’ll receive an error like this:

The selected tapes cannot be marked as free because they belong to protection groups.
You need to stop protection of the associated protection groups before you can mark the tapes as free. The protection group that a tape belongs to is listed in the Protection Group column. (ID: 31116)

You can still force DPM to mark the tape as free by removing the recovery points. Use the following script in the DPM Powershell.

$barcode = "000012L4"     #type the barcode of the tape that shall be marked as free
$dpmserver = "DPMSERVER"  #type your dpm server's name here

$DPMLib = Get-DPMLibrary -DPMServerName $dpmserver
$tape = Get-Tape -DPMLibrary $DPMLib | Where-Object {$_.Barcode.Value -eq $barcode}

foreach ($RecoveryPoint in @(Get-RecoveryPoint -Tape $tape))
{
   Remove-RecoveryPoint -RecoveryPoint $RecoveryPoint -ForceDeletion -Confirm:$false
}

I chose to select the tapes by barcode. You can change the code easily to match your needs.

This script will delete all recovery points on the tape identified by its barcode – so please be careful…

9 Comments

  1. $barcode = “EI0502L4”
    $dpmserver = “xyx-scdpm-01”
    $DPMLib = Get-DPMLibrary -DPMServerName $dpmserver
    $tape = Get-Tape -DPMLibrary $DPMLib | Where-Object {$_.Barcode.Value -eq $barcode}
    foreach ($RecoveryPoint in @(Get-RecoveryPoint -Tape $tape))
    {
    Remove-RecoveryPoint -RecoveryPoint $RecoveryPoint -ForceDeletion -Confirm:$false
    }
    ……………………………………………………………..
    I get the attached error message please your help will be highly appriciated.
    C:\Tape Drive Tools\DPMeraseTape\marktapefree.ps1:5 char:47
    + foreach ($RecoveryPoint in @(Get-RecoveryPoint <<<< -Tape $tape))
    + CategoryInfo : ObjectNotFound: (Get-RecoveryPoint:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  2. Which version of DPM are you using?

  3. hello! use your script in a library with 24 tapes, and it worked perfect.
    but I use an IBM ultrium-hh5 sequental scsi device, which is a single tape, does not generate the barcode and I can not use this script, is there another way?

  4. Yes, sure. You can use

    $dpmserver = "DPMSERVER"  #type your dpm server's name here
    $DPMLib = Get-DPMLibrary -DPMServerName $dpmserver
    Get-Tape -DPMLibrary $DPMLib | fl
    

    You should get a list of all known tapes with their properties. Choose on which you want to match and edit this part Where-Object {$_.Barcode.Value -eq $barcode} accordingly.

  5. Dear
    Norman
    I just want to say thank you very much as your script works perfect and I am using from time to time.
    God Bless
    Paulos
    London
    UK

  6. Heres exactly opposite of what you are doing. I accidently deleted the recovery points from Tape for a server we no longer have but need to keep the info for two years. We know we have the info on tape but the database has lost the info. Anyway to get that back?

  7. Well, I believe you could simply load the tape and do an inventory job on it. Even though the recovery points have been marked expired you should be able to restore as unknown or foreign data.

  8. Hi Norman – im tying to run your script on a standalone tape drive also and im not being succesfull – bearing in mind DPM and POwershell is new to me.

    DO I add the 3 lines in over the original lines?

    $dpmserver = “CRMDPM002” #type your dpm server’s name here
    $DPMLib = Get-DPMLibrary -DPMServerName $dpmserver
    Get-Tape -DPMLibrary $DPMLib | fl

    $tape = Get-Tape -DPMLibrary $DPMLib | Where-Object {$_.barcode.Value -eq $barcode}

    foreach ($RecoveryPoint in @(Get-RecoveryPoint -Tape $tape))
    {
    Remove-RecoveryPoint -RecoveryPoint $RecoveryPoint -ForceDeletion -Confirm:$false
    }

    Your comment “You should get a list of all known tapes with their properties. Choose on which you want to match and edit this part Where-Object {$_.Barcode.Value -eq $barcode} accordingly.” is the bit I don’t understand.

    this is the output when I run the 3 lines to identify the tapes

    Location : Drive-\\.\Tape2147483646
    Tape label : Production Servers-00000307
    Library : IBM ULTRIUM-HH5 SCSI Sequential Device
    Tape barcode : None
    Offsite Ready : False
    Protection Group : Production Servers

    what do I need to change in my script – your help is much appreciated

  9. I am using DPM 2012 r2 when i run script to delete recovery points I receive error
    ” At C:\Users\nb.operator\Desktop\New Text Document.ps1:14 char:62
    + foreach ($RecoveryPoint in @(Get-RecoveryPoint -Tape $tape))
    + ~
    Missing statement body in foreach loop.
    At C:\Users\nb.operator\Desktop\New Text Document.ps1:18 char:2
    + }
    + ~
    Unexpected token ‘}’ in expression or statement.
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingForeachStatement
    can anyone help me.

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha: * Time limit is exhausted. Please reload CAPTCHA.