How to Use a Windows PowerShell Script to Recover an Item in Data Protection Manager

How to Use a Windows PowerShell Script to Recover an Item in Data Protection Manager

This article will walk you through the steps of doing a simple file restore from Windows Powershell.  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>]

 That looks simple enough but let's take a closer look.  First 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 article.
You will be creating three variables

1.       $pg = get-protectiongroup –dpmservername dpmserver1

a.       This will return an array; assign an index value to the first one you see as 0, the second one will be 1, etc…clip_image002

2.       $ds = get-datasource –protectiongroup[$pg_arrayindexvaluefromabove]

a.       This will return an array

clip_image004

3.       $rp= get-recoverypoint –datasource[$ds_arrayindexvalue]

clip_image006

4.       $gr = get-recoverableitem –recoverableitem $rp[0]

clip_image008
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 file restored.

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…

 $rop

Once we have the $rop variable we can finally restore the file.

Captureend

You can see from the above screenshot that we are now in progress of putting the file back where it came from.

Note: This information was originally provided by Walt Whitman on the Data Protection Manager blog:

http://blogs.technet.com/dpm/archive/2010/01/06/recover-recoverable-item.aspx

Leave a Comment
  • Please add 6 and 4 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Richard Mueller edited Revision 4. Comment: Modified title casing, fixed typo, added tag

  • Patris_70 edited Revision 3. Comment: deleted (en-US) from title

  • Craig Lussier edited Revision 2. Comment: added en-US to tags and title

  • Ed Price - MSFT edited Revision 1. Comment: Made font consistent

Page 1 of 1 (4 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Ed Price - MSFT edited Revision 1. Comment: Made font consistent

  • Craig Lussier edited Revision 2. Comment: added en-US to tags and title

  • Patris_70 edited Revision 3. Comment: deleted (en-US) from title

  • Richard Mueller edited Revision 4. Comment: Modified title casing, fixed typo, added tag

Page 1 of 1 (4 items)