<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Recover-Recoverable Item</title><link>http://blogs.technet.com/b/dpm/archive/2010/01/06/recover-recoverable-item.aspx</link><description>Its 6:00PM. &amp;#160; You were supposed to leave at 5:00PM. &amp;#160; 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. &amp;#160; You say, “No problem, I will restore it real quick before</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Recover-Recoverable Item</title><link>http://blogs.technet.com/b/dpm/archive/2010/01/06/recover-recoverable-item.aspx#3352877</link><pubDate>Tue, 31 Aug 2010 15:41:52 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3352877</guid><dc:creator>BrianM</dc:creator><description>&lt;p&gt;Well, after much frustration and research, I have come up with a working script. &amp;nbsp;For those that want to know how to do the same, the script below works well to restore any given file.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;#&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Parameters: Folder Path, File to Restore, Deletion Date&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Example Usage: &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;.\RecoverFile.ps1 &amp;quot;ClientName\Folder\2010\02\03\&amp;quot; &amp;quot;mydoc.pdf&amp;quot; &amp;quot;2010-08-04 09:54:24.117&amp;quot; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;#&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$filePath = [IO.Path]::Combine(&amp;quot;D:\ClientData\&amp;quot;, $args[0] )&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$fileName = $args[1]&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$dateDeleted = Get-Date $args[2]&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Write-Host &amp;quot;Restoring &amp;#39;&amp;quot; -NoNewLine&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Write-Host $filePath -NoNewLine&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Write-Host $fileName -NoNewLine&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Write-Host &amp;quot;&amp;#39; which was deleted on &amp;#39;&amp;quot; -NoNewLine&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Write-Host $dateDeleted -NoNewLine&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Write-Host &amp;quot;&amp;#39;&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$recoveryDate = Get-Date $dateDeleted.AddDays(-1).ToShortDateString()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$pg = Get-ProtectionGroup -DPMServerName DPMSERVER01 | Where-Object {$_.FriendlyName -eq &amp;quot;Document Repository Data&amp;quot;} &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$ds = Get-Datasource $pg&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$so = New-SearchOption -FromRecoveryPoint $recoveryDate.AddDays(-1).ToShortDateString() -ToRecoveryPoint $recoveryDate.ToShortDateString() -SearchDetail FilesFolders -SearchType exactMatch -Location $filePath -SearchString $fileName&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$ri = Get-RecoverableItem -Datasource $ds -SearchOption $so&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$ro = New-RecoveryOption -TargetServer CLIENTDATASERVER01 -RecoveryLocation OriginalServer -FileSystem -OverwriteType overwrite -RecoveryType Recover&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$recoveryJob = Recover-RecoverableItem -RecoverableItem $ri -RecoveryOption $ro&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;#4.3 Wait till the recovery job completes&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;while (! $recoveryJob.hasCompleted )&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# Show a progress bar&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Write-Host &amp;quot;.&amp;quot; -NoNewLine&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Start-Sleep 1&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;if($recoveryJob.Status -ne &amp;quot;Succeeded&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Write-Host &amp;quot;Recovery failed&amp;quot; -ForeGroundColor Red&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Write-Host &amp;quot;Recovery successful&amp;quot; -ForeGroundColor Green&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3352877" width="1" height="1"&gt;</description></item><item><title>re: Recover-Recoverable Item</title><link>http://blogs.technet.com/b/dpm/archive/2010/01/06/recover-recoverable-item.aspx#3351425</link><pubDate>Mon, 23 Aug 2010 19:18:20 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3351425</guid><dc:creator>BrianM</dc:creator><description>&lt;p&gt;I’ve got what I thought would be a simple task with Data Protection Manager 2010 that is turning out to be quite frustrating. I have a file server on one server and it is the only server in a protection group. This file server is the repository for a document management application which stores the files according to the data within a SQL database. Sometimes users inadvertently delete files from within our application and we need to restore them. We have all the information needed to restore the files to include the file name, the folder that the file was stored in and the exact date that the file was deleted. It is easy for me to restore the file from within the DPM console since we have a recovery point created every day, I simply go to the day before the delete, browse to the proper folder and restore the file. The problem is that using the DPM console, the cumbersome wizard requires about 20 mouse clicks to restore a single file and it takes 2-4 minutes to get through all the windows. This becomes very irritating when a client needs 100’s of files restored… it takes all day of redundant mouse clicks to restore the files.&lt;/p&gt;
&lt;p&gt;Therefore, I want to use a PowerShell script (and I’m a novice at PowerShell) to automate this process. I want to be able to create a script that I pass in a file name, a folder, a recovery point date (and a protection group/server name if needed) and simply have the file restored back to its original location with some sort of success/failure notification. I thought it was a simple basic task of a backup solution, but I am having a heck of a time finding the right code.&lt;/p&gt;
&lt;p&gt;I have tried to use the sample code above, but it doesn’t accomplish what I really want to do (it’s too simplistic and not capable of being automated with the known values of the file to restore) and there are errors in the sample code. Therefore, I would like to get some help writing a script to restore these files. &lt;/p&gt;
&lt;p&gt;An example of the known values to restore the data are:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; DPM Server: BACKUP01 &lt;/p&gt;
&lt;p&gt; &amp;nbsp; Protection Group: Document Repository Data &lt;/p&gt;
&lt;p&gt; &amp;nbsp; Protected Server: FILER01 &lt;/p&gt;
&lt;p&gt; &amp;nbsp; File Path: R:\DocumentRepository\ToBackup\ClientName\Repository\2010\07\24\filename.pdf &lt;/p&gt;
&lt;p&gt; &amp;nbsp; Date Deleted: 8/2/2010 (last recovery point = 8/1/2010, exact time unknown though) &lt;/p&gt;
&lt;p&gt;Bonus Points:&lt;/p&gt;
&lt;p&gt;If you can help me not only create this script, but also show me how to automate by providing a text file with the above information that the PowerShell script loops through, or even better, is able to query our SQL server for the needed data, then I would be more than willing to pay for this development.&lt;/p&gt;
&lt;p&gt;You can reach me at brian-at-mccleary-dot-com&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3351425" width="1" height="1"&gt;</description></item><item><title>re: Recover-Recoverable Item</title><link>http://blogs.technet.com/b/dpm/archive/2010/01/06/recover-recoverable-item.aspx#3304191</link><pubDate>Thu, 07 Jan 2010 11:11:43 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3304191</guid><dc:creator>Klaus_L</dc:creator><description>&lt;p&gt;Why didn't the console open in the first place? This confirms my experience that the console performs poorly and that it is not possible to have two administrators use the console the same time.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3304191" width="1" height="1"&gt;</description></item><item><title>re: Recover-Recoverable Item</title><link>http://blogs.technet.com/b/dpm/archive/2010/01/06/recover-recoverable-item.aspx#3304108</link><pubDate>Wed, 06 Jan 2010 21:53:24 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3304108</guid><dc:creator>dbailey</dc:creator><description>&lt;p&gt;I have to say that compared to Exchange, DPM's PowerShell cmdlets are poorly documented and implemented. For instance, Get-ProtectionGroup can’t get you a protection group. It only gets you all of the protection groups. It should be called Get-ProtectionGroups.&lt;/p&gt;
&lt;p&gt;I should be able to get protection groups, data sources, etc. by name like the following (as you can get databases in Exchange):&lt;/p&gt;
&lt;p&gt;Get-ProtectionGroup “backupServer\Protection Group”&lt;/p&gt;
&lt;p&gt;instead of running a command, counting and referencing an index number or doing something ugly like: &lt;/p&gt;
&lt;p&gt;$pg = Get-ProtectionGroup -DPMServerName backupServer | Where-Object {$_.FriendlyName -eq &amp;quot;Protection Group&amp;quot;} &lt;/p&gt;
&lt;p&gt;(It’s also annoying that in the table output of $pg, the header is Name, but the property is actually FriendlyName – those things should be consistent so I don’t have to run get-member all the time.)&lt;/p&gt;
&lt;p&gt;This post also didn't go into restoring a particular file that's nested deeply. As far as I can tell, you either have to use Get-RecoverableItem -searchoption which is slow or navigate down using something like: &lt;/p&gt;
&lt;p&gt;$SubFolder1 = Get-RecoverableItem -RecoverableItem $rp -BrowseType child | Where-Object {$_.Filename -eq &amp;quot;SubFolder1&amp;quot;} &lt;/p&gt;
&lt;p&gt;$SubFolder2 = Get-RecoverableItem -RecoverableItem $SubFolder1 -BrowseType child | Where-Object {$_.Filename -eq &amp;quot;SubFolder2&amp;quot;} &lt;/p&gt;
&lt;p&gt;Once I have a recovery point, I should be able to pass the path of the file or folder I need to restore directly instead of the nonsense above.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3304108" width="1" height="1"&gt;</description></item></channel></rss>