Windows File Level Restore

PowerShell script exchange

Windows File Level Restore

Veeam Logoby snowmizer » Wed Feb 08, 2012 7:48 pm

I am trying to write a Powershell script that will restore a test file from my VMs in my Veeam Backups (running Veeam v6.0). If I'm reading correctly I need to use the start-vbrwindowsfilerestore cmdlet. However, when I try to restore a file I get a message "Cannot find path". I verified that the file I am restoring is in the path I specified. I also verified that the file is on the backups using the restore option in both the "Backup & Replication" console as well as the "Enterprise Manager" console.

What am I doing wrong?

Here's the script code I'm running:

$result = Get-VBRBackup | where {$_.JobName -eq "Backup_My_Servers"} | Get-VBRRestorePoint | sort CreationTime -Descending | where {$_.VMName -eq "ServerA"} | select -First 1 | Start-VBRWindowsFileRestore
$file = "c:\readme.txt”
Copy $file "E:\Special Restores\"
Stop-VBRWindowsFileRestore
snowmizer
Enthusiast
 
Posts: 26
Liked: never
Joined: Mon May 02, 2011 8:35 pm

Re: Updated below

Veeam Logoby ThomasMc » Wed Feb 08, 2012 9:14 pm

Try this out

Code: Select all
$WFLR = Get-VBRBackup -Name "Job Name" | Get-VBRRestorePoint -Name "vm.lab.local" |
   Sort CreationTime -Descending | Select -First 1 | Start-VBRWindowsFileRestore

Copy "$($WFLR.Drives)\readme.txt" "E:\Special Restores\"
Stop-VBRWindowsFileRestore


I suppose if the VM has multiple drives then you'll want to tweak it a little
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: Windows File Level Restore

Veeam Logoby snowmizer » Wed Feb 08, 2012 9:23 pm

Doesn't like the $WFLR.Drives option. My test file is c:\testfile.vbs but it looks for the file in C:\Users\...\Veeam.Backup.Powershell.Model.FileRestore.Drives\testfile.vbs.
snowmizer
Enthusiast
 
Posts: 26
Liked: never
Joined: Mon May 02, 2011 8:35 pm

Re: Windows File Level Restore

Veeam Logoby ThomasMc » Wed Feb 08, 2012 9:25 pm

Change it to
Code: Select all
"$($WFLR.Drives)\testfile.vbs"


It mounts it into a really long path for some reason i.e
Code: Select all
C:\Documents and Settings\Administrator.lab\Local Settings\Temp\1\scnrximq.54e


or whatever the alternative is for 2008
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: Windows File Level Restore

Veeam Logoby snowmizer » Thu Feb 09, 2012 3:55 pm

That gave me a wierd error...

Failed to initialize log [C:\ProgramData\Veeam\Backup\Aux.VeeamProxyClient.log].

Incorrect function
Seek operation has failed. File: [C:\ProgramData\Veeam\Backup\Aux.VeeamProxyClie
nt.log]. Distance to move: [0]. Move method: [FILE_END].
snowmizer
Enthusiast
 
Posts: 26
Liked: never
Joined: Mon May 02, 2011 8:35 pm

Re: Windows File Level Restore

Veeam Logoby ThomasMc » Thu Feb 09, 2012 4:11 pm

Lets try it a little different again

Code: Select all
cd $WFLR.Drives
Copy "readme.txt" "E:\Special Restores\"


Can you confirm that the VM this backup is for only has one drive attached to it?
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: Windows File Level Restore

Veeam Logoby snowmizer » Thu Feb 09, 2012 4:19 pm

It has more than one drive but only one is backed up via Veeam at this time (because of space constraints).
snowmizer
Enthusiast
 
Posts: 26
Liked: never
Joined: Mon May 02, 2011 8:35 pm

Re: Windows File Level Restore

Veeam Logoby snowmizer » Mon Feb 13, 2012 9:04 pm

Working with support on this issue and discovered that the cmdlet Start-VBRWindowsFileRestore is either broken or 1/2 completed. Anyone else have any advice on how I can achieve this objective via scripting. I really can't afford to have to do a manual restore on every server, every month end.
snowmizer
Enthusiast
 
Posts: 26
Liked: never
Joined: Mon May 02, 2011 8:35 pm


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests