none
Need DPM powershell script to restore a folder to different server RRS feed

  • Question

  • Hi,

    I have folder backed up to DPM. Need a script to recover the last recovery point to another server with DPM agent on it. Can someone provide an example?

    Thanks

    Monday, July 22, 2019 12:38 PM

All replies

  • Hi,

    You can make use of the Restore-DPMRecoverableItem PowerShell cmdlet to restore items, there's an example on the documentation site on how to use it.

    I've written a guide on how to protect a folder with PowerShell in DPM, you can use the same guide pretty much and change a few things to restore instead of protecting.

    You can find the guide over here: DPM: Step-by-Step How to protect a folder with PowerShell

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    Monday, July 22, 2019 12:50 PM
  • Thanks, but I can't figure out correct command for $ROption

    Import-Module DataProtectionManager
    $PGroup = Get-DPMProtectionGroup -DPMServerName "DPMServer"| Where-Object {$_.FriendlyName.ToUpper() -eq "GroupName"}
    $PObjects = Get-DPMDatasource -ProtectionGroup $PGroup[0]
    $RPoint = Get-DPMRecoveryPoint -Datasource $PObjects[0] | Sort -Property RepresentedPointInTime -Descending | Select-Object -First 1
    $ROption = New-DPMRecoveryOption -HyperVDatasource -TargetServer "TargetPCName" -RecoveryLocation AlternateHyperVServer -RecoveryType Recover -TargetLocation "C:\VMRecovery"
    Restore-DPMRecoverableItem -RecoverableItem $RPoint -RecoveryOption $ROption

    Restore-DPMRecoverableItem : The specified recovery options are not valid. (ID: 31095) (It's not hyperv, so it seems ok)

    If I use:

    Import-Module DataProtectionManager
    $PGroup = Get-DPMProtectionGroup -DPMServerName "DPMServer"| Where-Object {$_.FriendlyName.ToUpper() -eq "GroupName"}
    $PObjects = Get-DPMDatasource -ProtectionGroup $PGroup[0]
    $RPoint = Get-DPMRecoveryPoint -Datasource $PObjects[0] | Sort -Property RepresentedPointInTime -Descending | Select-Object -First 1
    $RItem = Get-RecoverableItem -RecoverableItem $RPoint -BrowseType Child
    $ROption = New-DPMRecoveryOption -GenericDatasource -TargetServer "TargetPCName" -RecoveryLocation CopyToFolder -RecoveryType Recover -TargetLocation "C:\VMRecovery"
    Restore-DPMRecoverableItem -RecoverableItem $RItem -RecoveryOption $ROption

    I get:

    New-DPMRecoveryOption : The recovery point location that you have passed is invalid. Please try again with a different value. (ID: 31050)

    Monday, July 22, 2019 1:41 PM
  • Monday, July 22, 2019 8:42 PM
  • I've tried the script to recover a single file:

    You choose to recover file to pcname at the C:\temp\ with the original security settings
    Restore-DPMRecoverableItem : The specified recovery options are not valid. (ID: 31095)
    Check the parameters that you are passing to the cmdlet and ensure that these parameters correspond to the data source type that you are attempting to recover.
    At line:84 char:16
    + ... coveryJob = Restore-DPMRecoverableItem -RecoverableItem $ri -Recovery ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Restore-DPMRecoverableItem], DlsException
        + FullyQualifiedErrorId : InvalidRecoveryOptions,Microsoft.Internal.EnterpriseStorage.Dls.UI.Cmdlet.RecoveryCmdLets.RecoverRecoverableItem
    Also tried to recover to a network share, where it successfully recovers using GUI. Same error. Maybe there is some debugging option to see what commands GUI executes during recovery process?


    • Edited by TRIUMF Tuesday, July 23, 2019 6:04 AM
    Tuesday, July 23, 2019 5:57 AM