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.
[code lang=”ps”]
$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
}
[/code]
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…
$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
Which version of DPM are you using?
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?
Yes, sure. You can use
[code]
$dpmserver = "DPMSERVER" #type your dpm server’s name here
$DPMLib = Get-DPMLibrary -DPMServerName $dpmserver
Get-Tape -DPMLibrary $DPMLib | fl
[/code]
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.
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
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?
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.
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
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.
No change occurred however script executed successfully but the tape still not free .
PS C:\Program Files\Microsoft System Center\DPM\DPM\bin> $barcode = “001153” #type the barcode of the tape that shall be marked as free
PS C:\Program Files\Microsoft System Center\DPM\DPM\bin> $dpmserver = “ABCDS” #type your dpm server’s name here
PS C:\Program Files\Microsoft System Center\DPM\DPM\bin>
PS C:\Program Files\Microsoft System Center\DPM\DPM\bin> $DPMLib = Get-DPMLibrary -DPMServerName $dpmserver
WARNING: Connecting to DPM server: BOKHO-DPM
PS C:\Program Files\Microsoft System Center\DPM\DPM\bin> $tape = Get-Tape -DPMLibrary $DPMLib | Where-Object {$_.Barcode.Value -eq $barcode}
PS C:\Program Files\Microsoft System Center\DPM\DPM\bin>
PS C:\Program Files\Microsoft System Center\DPM\DPM\bin> foreach ($RecoveryPoint in @(Get-RecoveryPoint -Tape $tape))
>> {
>> Remove-RecoveryPoint -RecoveryPoint $RecoveryPoint -ForceDeletion -Confirm:$false
>> }