none
How to adapt for stand alone tape drive (How to Mark a Tape as Free) RRS feed

  • General discussion

  • http://technet.microsoft.com/en-us/library/jj628145.aspx

    Found this great script on TechNet, but as a beginner in DPM (2012 SP1 beta) in a test environment with a single stand alone drive, I'm really having trouble adapting the parameters relating to libraries and slots to a single stand alone drive.

    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."
            }
        }
    }


    CarolChi

    Wednesday, December 19, 2012 8:35 PM

All replies

  • If you are using the script on a standalone tape device (versus a library with multiple slots), you have to fill in the following for tape location:

    Drive-\\.\Tape0 where \\.\Tape0 is the windows symbolic name of the device when you highlight your tape drive in the DPM Console.

    Example:

    PS C:\Program Files\Microsoft DPM\DPM\bin> force-freetape.ps1
    DPM server name: : dpm1
    Library name: : Quantum LTO 4 drive
    Tape location: : drive-\\.\Tape2147483644


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, December 31, 2012 10:10 PM
    Moderator
  • So if I wanted to hard code this for a particular system I could get rid of the parameter line and put

    $DPMServerName = "DPM2012"
    $LibraryName =  "Hewlett Packard LTO Ultrium-5 drive"
    $TapeLocationList = \\.\Tape2147483646

    What does the 2147483646 mean? Is that a code for  the type of device?

    Trying this:

    $DPMServerName = "DPM2012"
    $LibraryName = "Stand-alone Drive: Hewlett Packard DAT160 USB drive"
    $TapeLocationList = Drive-\\.\Tape0

    Drive-\\.\Tape0 : The module 'Drive-' could not be loaded. For more
    information, run 'Import-Module Drive-'.
    At C:\Program Files\Microsoft System Center 2012\DPM\DPM\bin\ForceFree.ps1:7
    char:21
    + $TapeLocationList = Drive-\\.\Tape0
    +                     ~~~~~~~~~~~~~~~


    CarolChi


    Tuesday, January 1, 2013 8:17 AM
  • Hi,

    Drive-\\.\Tape# where \\.\Tape# is the windows symbolic name of the device when you highlight your tape drive in the DPM Console and look at the details at the bottom.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, January 1, 2013 2:55 PM
    Moderator
  • Thanks I understand this, but I am still getting en error:

    Drive-\\.\Tape0 : The module 'Drive-' could not be loaded. For more
    information, run 'Import-Module Drive-'.
    At C:\Program Files\Microsoft System Center 2012\DPM\DPM\bin\ForceFree.ps1:7
    char:21
    + $TapeLocationList = Drive-\\.\Tape0


    CarolChi

    Tuesday, January 1, 2013 4:34 PM
  • Hi,

    Please run this in a single command:

    force-freetape.ps1 -dpmservername DPM2012 -libraryname "Hewlett Packard DAT160 USB drive" -tapelocationlist Drive-\\.\Tape0

    Where the library name and the tape# come from the details of the standalone drive.

    example:

    force-freetape.ps1 -dpmservername DPM2012 -libraryname "Firestreamer tape drive" -tapelocationlist Drive-\\.\Tape2147483646


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, January 3, 2013 12:59 AM
    Moderator