This script allows a user to mark any tape as free so that it is available for protection by DPM. Tapes which have unexpired data cannot be marked as free from the GUI but sometimes (esp. while testing) users need to override this behaviour.
Save this script as a .ps1 file and run it. Usage and examples of scripts can be found by calling them with ‘-?’ or ‘-help’ from inside DPM Management Shell.
----------------------------- Start of Script --------------------------------
param
([string] $DPMServerName, [string] $LibraryName, [string[]] $TapeLocationList)if
(("-?","-help") -contains $Args[0])
if (!$DPMServerName)
{
$DPMServerName = Read-Host "DPM server name: "
if (!$DPMServerName)
{
Write-Error "Dpm server name not specified."
exit 1
}
}
if (!(Connect-DPMServer $DPMServerName))
{
Write-Error "Failed to connect To DPM server $DPMServerName"
exit 1
}
$library
= @(Get-DPMLibrary $DPMServerName )if
(!$LibraryName)Write-Error "Library name not specified."
if
(!$TapeLocationList)
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."
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.