PowerShell script exchange
Post Reply
john.aubrey
Enthusiast
Posts: 31
Liked: 5 times
Joined: Jan 29, 2020 9:43 pm
Full Name: John Aubrey
Contact:

Start-VBRTapeRestore help....

Post by john.aubrey »

I'm going to start with the fact I know this is obsolete, and no longer supported. I'm on v10, so that isn't helping at all....

I'm trying to automate some powershell code to restore a few VM's a weekend back to the repository. I started here: https://helpcenter.veeam.com/docs/backu ... ml?ver=100

The thing is, it works for some server restores and not others. Some of them work, and some instantly fail with:

Code: Select all

3/9/2020 10:15:28 AM Error    %ServerName% cannot be restored: Veeam.Tape.Core.InvalidChainException: Oib [vmname=%ServerName%:creation_time=3/6/2020 6:06:23 PM:creation_time_utc=3/6/2020 11:06:23 PM:alg=Full:id=e564e1ae-4e0a-4ec2-ba05-994db1fa8ba8:point_id=47c31f15-1949-48b2-810a-2f96dfd93174:storage_id=b456b41a-0617-44bb-91f6-0107e1eb5969:parent_id=00000000-0000-0000-0000-000000000000:link_id=00000000-0000-0000-0000-000000000000:original_oib_id=e564e1ae-4e0a-4ec2-ba05-994db1fa8ba8:isCorrupted=False] storage not found.
                                 at Veeam.Backup.
My Script:

Code: Select all

Add-PSSnapin VeeamPSSnapIn
Connect-VBRServer -server %VeeamServer%
$Respoitory = Get-VBRBackupRepository -Name "Storage"
$Server1 = "%ServerName%"
$GetTapeRestorePoint = Get-VBRRestorePoint | Where {$_.Name -eq $Server1 } |Select -last 1 

Start-VBRTapeRestore -RestorePoint $GetTapeRestorePoint -Repository $Respoitory -Reason "Tape Verification" -RunAsync
If I run the "Restore back to repository" via GUI, we are all golden, so I know the data is good.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Start-VBRTapeRestore help....

Post by oleg.feoktistov » 1 person likes this post

Hi John,

Your script retrieves all restore points you have and then sort them by a server name / position in an array.
However, a caveat for this approach is that, if you have a machine backed by both tape job and regular,
you can encounter the behavior when the last restore point your script sorted is actually created by a regular backup job, not the tape one.
Thus, this error is thrown.

Instead, try getting tape backups and then querying restore points inside them:

Code: Select all

 $GetTapeRestorePoint = Get-VBRTapeBackup | Get-VBRRestorePoint | Where {$_.Name -eq $Server1 } | Sort-Object CreationTime | Select -Last 1 
Thanks,
Oleg
john.aubrey
Enthusiast
Posts: 31
Liked: 5 times
Joined: Jan 29, 2020 9:43 pm
Full Name: John Aubrey
Contact:

Re: Start-VBRTapeRestore help....

Post by john.aubrey »

Thanks, That worked.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 7 guests