Hi,
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
Any help would be appreciated.
-
- Influencer
- Posts: 10
- Liked: 1 time
- Joined: Oct 08, 2017 11:23 pm
- Full Name: Serkan Tek
- Contact:
-
- Veeam Software
- Posts: 1818
- Liked: 655 times
- Joined: Mar 02, 2012 1:40 pm
- Full Name: Timothy Dewin
- Contact:
Re: Scheduled file restore
well starting it, there is actually a good script in the manual
https://helpcenter.veeam.com/docs/backu ... 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
Code: Select all
$origfile = "C:\Reports\June.xlsx"
$result = Get-VBRBackup | where {$_.jobname -eq "Job 1"} | Get-VBRRestorePoint | where {$_.name -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
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
-
- Influencer
- Posts: 10
- Liked: 1 time
- Joined: Oct 08, 2017 11:23 pm
- Full Name: Serkan Tek
- Contact:
Re: Scheduled file restore
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"
Thanks.
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"
Thanks.
Who is online
Users browsing this forum: No registered users and 12 guests