Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.