RemoveRecoveryPoint.ps1

このソースの解説はこちらから。
【Management】DPM2007 管理シェルで保護領域の容量不足を回避する その2  

*********************

param([string] $DPMServerName, [string] $ProtectionGroupName,[string] $Datasource, [string] $RepeisentedPointInTime)

if(!$DPMServerName)
{
     $DPMServerName = read-host "DPMサーバー名:"
}

$DPMServer = Connect-DPMServer $DPMServerName

if(!$ProtectionGroupName)
{
     $PGList = Get-ProtectionGroup $DPMServerName
     $PGList 
     Write-Host "保護グループを選択してください"
     $ProtectionGroupName = read-host "保護グループ名:"
}

$pg = Get-ProtectionGroup $DPMServerName | where {$_.FriendlyName -eq $ProtectionGroupName}

if(!$Datasource)
{
     $DSList = Get-Datasource $pg | format-table Name,ProductionServerName
     $DSList
     Write-Host "データソースを選択してください"
     $Datasource = read-host "データソース名:"
}

$ds = Get-Datasource -ProtectionGroup $pg | where {$_.Name -eq $Datasource}

$ds

$RPList = Get-RecoveryPoint -DataSource $ds |format-table RepresentedPointInTime,UserFriendlyName,Size |out-string

if(!$ReprisentedPointInTime)
{
     $RPList
     Write-Host "削除したい回復ポイントの RepresentedPointInTime を指定してください"
     $RepresentedPointInTime = read-host "回復ポイントの日時:"
}

$RP = Get-RecoveryPoint -DataSource $ds | where {$_.RepresentedPointInTime -eq $RepresentedPointInTime}

Write-Host "回復ポイントを削除します"
Write-Host "-- 保護グループ:: $ProtectionGroupName"
Write-Host "-- 回復ポイント:: $RepresentedPointInTime"

#Remove-RecoveryPoint -RecoveryPoint $rp -ForceDeletion -Confirm:$false
Remove-RecoveryPoint -RecoveryPoint $rp