Problem with script for automating DPM recovery

Hello all,

I need to automate monthly restoration of all my backups in DPM2012R2 to HDDs.

I generally know what I need to do but I run in issue with geting recovery points for my SQL backups.

$rps = get-datasource -DPMServerName <DPM_SERVER> | ForEach-Object -Process {$_.GetRecoveryPoint()[-1]} 

foreach ($rp in $rps) {
    Get-DPMRecoverableItem -RecoverableItem $rp -BrowseType Child
}

$rps gave me the most recent version of RecoveryPoint but when I run Get-Recovery point on every object from $rps it shows me only non MSSQL recovery points. I tried it to run without [-1] in GetRecoveryPoint() method but without any effect.

Do you know what can be wrong?

April 23rd, 2015 7:27am

Hi,

here you get my example Script, how to recover a SQL Datasource.

$Location="X:\Dezember13\SQL_Datenbank_30T_60W"
$Date=Get-Date -Format MM-yyy (12.2013)
$MonthBefore=(Get-Date($DAte)).AddMinutes(-1)
$MonthAfter=(Get-Date($DAte)).AddMonths(1)

$pg = Get-ProtectionGroup -DPMServerName SCDPM-ss | where {$_.name -match "SQL"}
$ds = Get-Datasource $pg 
$rop = New-RecoveryOption -SQL -TargetServer "SCDPM-ss"  -RecoveryLocation CopyToFolder -RecoveryType Restore -TargetLocation $Location

foreach ($entry in $DS) {
    $rpl = Get-RecoveryPoint $Entry | sort -Property RepresentedPointInTIme | Where-Object {$_.Backuptime -lt "$MonthAfter" -and  $_.Backuptime -gt "$MonthBefore"}
    Recover-RecoverableItem -RecoverableItem $rpl[0] -RecoveryOption $rop
}

Free Windows Admin Tool Kit Click here and download it now
April 23rd, 2015 10:38am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics