How to auto mark tape as free in DPM 2012

scdpmtape

I have a backup server running System Center Data Protection Manager 2012, connected to a couple of tape drives (no library). I also have, of course, some tapes. Tape rotation is manual.

The tape have been used before, by DPM itself (but the server has been completely rebuilt) and by other backup softwares; they are not emtpy. But they contain no data that DPM knows and/or wants to preserve, so they can be marked as free without having to run forcefreetape.ps1.

When a tape is placed into the drive, it is required to perform an inventory, have it recognized as an imported tape and then mark it as free; otherwise DPM will simply refuse to use it.

How can I tell DPM to automatically treat those imported tapes as free? And, of course, I do not want to reuse real backup tapes if by chance they get put into the drives before their expiration date, so the solution should mark imported tapes as free, but should not do the same with real, non-expired tapes.

Best Answer

As usual, a bit of scripting is needed...

Import-Module DataProtectionManager

$Server = Get-Content env:computername

Get-DPMLibrary $Server | foreach {
    write-host
    write-host Starting inventory for library $_.UserFriendlyName

    $result = Start-DPMLibraryInventory -DPMLibrary $_ -DetailedInventory

    while (!$result.HasCompleted)
    {
        write-host -NoNewline "."
        sleep 1
    }

    write-host
    write-host Inventory complete for library $_.UserFriendlyName

    write-host Setting tape in library $_.UserFriendlyName as free

    Get-DPMTape $_ | Set-DPMTape -Free

    write-host Operation completed for library $_.UserFriendlyName
}