Page 1 of 1

Scheduled file restore

Posted: May 18, 2018 1:04 am
by serkantek

We have a requirement in our company to restore specific files and folder from the most recent backup of a particular production server running Windows Server 2012 R2 to a different server in our development environment running the same OS.

I have been looking through powershell scripts but I am finding it hard to write anything to set the restore location to a different host.
One thing I can think of is to restore the files back onto the production machine to a different drive, then run a robocopy job to move the files to the development server.
I would like to automate the process as much as possible.

What would be the best way of achieving this? And can someone please help with the scripting part :D

Any help would be appreciated.

Re: Scheduled file restore

Posted: May 23, 2018 6:42 pm
by tdewin
well starting it, there is actually a good script in the manual

Code: Select all

$origfile = "C:\Reports\June.xlsx"
$result = Get-VBRBackup | where {$_.jobname -eq "Job 1"} | Get-VBRRestorePoint | where {$ -eq "VM1"} | Sort-Object creationtime -Descending | Select-Object -First 1 | Start-VBRWindowsFileRestore
$flrmountpoint = ($result.MountSession.MountedDevices | ? {$_.DriveLetter -eq (Split-Path -Qualifier $origfile)}).MountPoint
$file = $flrmountpoint + (Split-Path -NoQualifier $origfile)
Copy $file c:\
Stop-VBRWindowsFileRestore $result ... tml?ver=95

So if you want to copy out a file with robocopy, you can use instead of copy, your tool and the source file should be in $file. Hope that helps

Re: Scheduled file restore

Posted: May 23, 2018 11:13 pm
by serkantek
Hi tdewin,

Thank you for your assistance. So my only option would be to restore onto the source backup server in a seperate location then copy to remote server (with some sort of tool)?

I have seen this script before but was unsure if I could add to this to specify a remote server as the restore path.

Just a few of questions -
1. How can I specify a different restore destination rather than original backup location. Is it as easy as defining a new variable?

$restorelocation = "E:\Restores"
$flrmountpoint = ($result.MountSession.MountedDevices | ? {$_.DriveLetter -eq (Split-Path -Qualifier $restorelocation)}).MountPoint

2. I need to exclude 3 files in the folder that I would like to restore either from the restore job or the copy job. What would be the best way? To mention the exclusion in $origfile or to mention the exclusion in copy?

3. If I used the Veeam copy function, can I put network a location in the copy job?
Copy $file "\\remoteserver1\d$\restore\files"