Its 6:00PM. You were supposed to leave at 5:00PM. Your boss catches you as you walk out the door and says he needs a file restored for a presentation first thing in the morning. You say, “No problem, I will restore it real quick before I head home.” You head to the DPM server and try and open the console. To your dismay, the console will not open. You inform your boss of the situation. He asks if there is any way at all to restore the file because he cannot wait until the morning. You remember that when you installed DPM that it required PowerShell. Maybe there is a way to restore files from the DPM Management Shell? You are exactly right! But you have never done it.
This blog will walk you through the steps of doing a simple file restore from Powershell.
From previous blogs you learned some of the fundamentals of Powershell; specifically arrays and index values. In this PowerShell cmdlet you will put that knowledge to the test.
This is the command as listed in Technet:
Recover-RecoverableItem [-RecoverableItem] <RecoverableObject> [-RecoveryOption] <RecoveryOptions> [-RecoveryPointLocation <RecoverySourceLocation>] [-JobStateChangedEventHandler <JobStateChangedEventHandler>] [-RecoveryNotification <Nullable`1>] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>]
Looks too difficult to attempt at 6:15PM right? Wife is waiting for you to eat dinner, kids need their baths, etc… Sound familiar?
Let’s simply this cmdlet; you will need some information to do the recovery.
What you will need:
1. Recoverable Object
2. Recovery Options
3. Recovery Point Location
First we need to get a recoverable object. Easy enough right? Wrong, it requires three variables and those have to be indexed into the get-recoverypoint cmdlet so technically you get two cmdlets for the price of one in this blog.
You will be creating three variables
1. $pg = get-protectiongroup –dpmservername dpmserver1
2. $ds = get-datasource –protectiongroup[$pg_arrayindexvaluefromabove]
a. This will return an array
3. $rp= get-recoverypoint –datasource[$ds_arrayindexvalue]
4. $gr = get-recoverableitem –recoverableitem $rp
Once you have the above three variables created you can now determine which recovery point you want to restore. No, we are not done yet but we now have most of the information necessary to perform the recovery. Just a few more variables and we are done.
Let’s look at recover-recoverableitem again. This time we will look at the bare minimum that you will need to get your bosses file restored so you can get out the door to go home.
Recover-RecoverableItem [-RecoverableItem] <RecoverableObject> [-RecoveryOption] <RecoveryOptions> [-RecoveryPointLocation <RecoverySourceLocation>]
Recover-recoverableitem requires 3 pieces of information. We have the recoverable object in the array index value from $rp above.
We also need recovery options ($rop.) This is another variable. It takes information that you input and when the item is recovered, it uses these variables to overwrite the file, restore the file, etc…
Once we have the $rop variable we can finally restore the file.
You can see from the above screenshot that we are now in progress of putting the file back where it came from.
Support Escalation Engineer
Microsoft System Center Support