Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Is this working? I got error: Start-DPMLibraryInventory : Operation failed because Stand Alone Drive Tape Library IBM ULTRIUM 5 HH 3580 TAPE DRIVE is offline. (ID: 31137) At C:\Program Files\Microsoft System Center 2012\DPM\DPM\bin\AutoMarkExpiredTapesAsFreeAfterDetailInventory.ps1:9 char:40 + $result = Start-DPMLibraryInventory <<<< -DPMLibrary $_ -DetailedInventory + CategoryInfo : NotSpecified: (:) [Start-DPMLibraryInventory], LibraryOfflineException + FullyQualifiedErrorId : LibraryOffline,Microsoft.Internal.EnterpriseStorage.Dls.UI.Cmdlet.StartInventory –  cronosmachine Aug 15 at 2:52

2 Answers 2

up vote 1 down vote accepted

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
}
share|improve this answer

I was having the the EXACT SAME issue. The problem is that the script above in the previous answer, doesn't account for all the devices that may be associated with DPM. The way the above script is written, it takes the very first device with a device ID of [0]. (Which is usually assigned to the Tape Drive & not the Library). So you must address the proper device in the script. You can issue a Get-DPMLibrary command to get a listing of all your devices.

Get-DPMLibrary -DPMServerName "yourservername"

This will list all devices associated with DPM in the order of lowest device number [0] to highest.

The library would normally be listed as the second entry, which is entry 1 as the devices start at 0....

(Notice the device number & the added code line 3 for the $DPMLibrary variable)

I also removed "Get-DPMTape $_ | Set-DPMTape -Free" It simply didn't work ! I replaced it with:

$Tape = Get-Tape -DPMLibrary $DPMLibrary

Set-DPMTape -Tape $Tape -Free

Note: The Set-DPMTape -Tape $Tape -Free Will produce errors. (don't be alarmed). It has to do with tapes already being associated with protection groups. The code WILL mark all the tapes as free none-the-less.

(So just copy the script below replacing your device ID).... enjoy :)

Import-Module DataProtectionManager

$Server = Get-Content env:computername

$DPMLibrary = get-dpmlibrary -DPMServerName $Server

Get-DPMLibrary $Server | foreach {
    write-host
    write-host Starting inventory for library $DPMLibrary[2]

    $result = Start-DPMLibraryInventory -DPMLibrary $DPMLibrary[2] -DetailedInventory

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

    write-host
    write-host Inventory complete for library $DPMLibrary[2]

    write-host Setting tape in library $DPMLibrary[2] as free

    $Tape = Get-Tape -DPMLibrary $DPMLibrary
    Set-DPMTape -Tape $Tape -Free

    write-host Operation completed for library $DPMLibrary[2]
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.