1

I need to restore a VM covered by DPM 2010 via powershell. I searched with google and it is kind of painfull to find no usefull documentation about DPM and Powershell.

Parameters: - VMs are running on Cluster Shared Volumes with Server 2005 R2 on Server 2003 64 bit Nodes - DPM 2010 Server Agent is installed on both nodes - restoration of VMs works fine with DPM GUI

What do I want? - daily restore latest virtual machines to network place

Current status of my script:

$pg = get-protectiongroup -dpmservername DPM2010
$ds = get-datasource -protectiongroup $pg
$rp = get-recoverypoint -datasource $ds[0]

What it does:

$pg shows me the Protection Groups, ok.
$ds shows me all virtual machines from the Recovery Group, nice.
$rp shows me all recovery points of the Virtual Machine from line 0, awesome!

Now I don't know how to go ahead. I want to get the latest Recovery Item and want to restore it to a network share anywhere on the network.

How do I have to do that?

Thanks!!

Tobi

cyntaxx
  • 57
  • 3
  • 9

1 Answers1

0

Current working Script:

#set target location
$targetserver  = "FQDN of Server"
$targetlocation = "drive letter with :\"

#get protectiongroup name
$pg = get-protectiongroup -dpmservername DPMServerName

#get all Virtual Machines from recovery group
$ds = get-datasource -protectiongroup $pg

#how many VMs do we have?
$an = $ds.count

#as long as: a is null, run as long as a is < 9 and a+1
For ($a = 0; $a -lt $an; $a++)
{
  $rp = get-recoverypoint -datasource $ds[$a] | sort -Property RepresentedPointInTime -Descending | select -First 1
  $Rop = New-RecoveryOption -GenericDatasource -TargetServer $targetserver -RecoveryLocation CopyToFolder -RecoveryType Restore -TargetLocation $targetlocation
  Recover-RecoverableItem -RecoverableItem $Rp -RecoveryOption $rop
}
cyntaxx
  • 57
  • 3
  • 9